{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "870bf132",
   "metadata": {},
   "source": [
    "# Basic gates in measurement-based quantum computation (MBQC)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "d7d26c86",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-30T01:31:14.699591Z",
     "start_time": "2023-08-30T01:31:12.887759Z"
    }
   },
   "outputs": [],
   "source": [
    "import deepquantum as dq\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d2f301b7",
   "metadata": {},
   "source": [
    "## Single-qubit operation $HR_z(-\\alpha)|+\\rangle$"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "366e7664",
   "metadata": {},
   "source": [
    "Matrix representation for $R_z(\\alpha)$ and $|+>$ state\n",
    "$$ R_z(\\alpha) =\n",
    "\\begin{pmatrix}\n",
    "e^{-i\\alpha/2} & 0 \\\\\n",
    "0              & e^{i\\alpha/2}\n",
    "\\end{pmatrix}\\\\\n",
    "|+> = \\frac{\\sqrt{2}}{2} \\begin{pmatrix}\n",
    "1 \\\\\n",
    "1 \\\\\n",
    "\\end{pmatrix}\n",
    "$$\n",
    "\n",
    "$$ R_z(\\alpha)|+> =\n",
    "\\frac{\\sqrt{2}}{2} \\begin{pmatrix}\n",
    "e^{-i\\alpha/2} \\\\\n",
    "e^{i\\alpha/2} \\\\\n",
    "\\end{pmatrix}\n",
    "$$\n",
    "\n",
    "The following circuits are equivalent\n",
    "\n",
    "![MBQC example](./figure/basic_gate_MBQC/RZ.jpg)\n",
    "<div style=\"text-align:center\">图 1: MBQC实现单比特门 $HR_z(-\\alpha)|+\\rangle$ 操作</div>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "f76f4ee8",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-29T09:37:41.250520Z",
     "start_time": "2023-08-29T09:37:41.062107Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The probability of deferred measurement to get \"1\" is 0.49999991059303284.\n",
      "tensor([[ 8.6603e-01+2.9802e-08j, -1.4901e-08+5.0000e-01j]])\n",
      "tensor([[ 8.6603e-01+2.9802e-08j, -1.4901e-08+5.0000e-01j]])\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"451.800047pt\" height=\"172.003598pt\" viewBox=\"0 0 451.800047 172.003598\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2023-08-30T13:21:29.585452</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.7.2, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 172.003598 \n",
       "L 451.800047 172.003598 \n",
       "L 451.800047 0 \n",
       "L 0 0 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 315.272388 126.445663 \n",
       "L 327.324428 126.445663 \n",
       "L 321.298408 135.137038 \n",
       "z\n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: #778899\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 407.980387 126.445663 \n",
       "L 420.032427 126.445663 \n",
       "L 414.006407 135.137038 \n",
       "z\n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: #778899\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_1\">\n",
       "    <path d=\"M 64.497252 44.2832 \n",
       "L 439.964647 44.2832 \n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: none; stroke: #000000; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_2\">\n",
       "    <path d=\"M 64.497252 90.637199 \n",
       "L 439.964647 90.637199 \n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: none; stroke: #000000; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_3\">\n",
       "    <path d=\"M 64.497252 135.484693 \n",
       "L 439.964647 135.484693 \n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_4\">\n",
       "    <path d=\"M 64.497252 138.497703 \n",
       "L 439.964647 138.497703 \n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_5\">\n",
       "    <path d=\"M 73.768051 141.626598 \n",
       "L 78.403451 132.355798 \n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: none; stroke: #778899; stroke-width: 1.5; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_6\">\n",
       "    <path d=\"M 135.882411 90.637199 \n",
       "L 135.882411 44.2832 \n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 265.905379 67.460199 \n",
       "L 283.983439 67.460199 \n",
       "L 283.983439 21.1062 \n",
       "L 265.905379 21.1062 \n",
       "z\n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: #bdbdbd; opacity: 0.6\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 265.905379 113.814199 \n",
       "L 283.983439 113.814199 \n",
       "L 283.983439 67.460199 \n",
       "L 265.905379 67.460199 \n",
       "z\n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: #bdbdbd; opacity: 0.6\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_7\">\n",
       "    <path d=\"M 322.804913 44.2832 \n",
       "L 322.804913 126.445663 \n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_8\">\n",
       "    <path d=\"M 319.791903 44.2832 \n",
       "L 319.791903 126.445663 \n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_9\">\n",
       "    <path d=\"M 369.158913 90.637199 \n",
       "L 369.158913 136.991198 \n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_10\">\n",
       "    <path d=\"M 366.145903 90.637199 \n",
       "L 366.145903 136.991198 \n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_11\">\n",
       "    <path d=\"M 415.512912 44.2832 \n",
       "L 415.512912 126.445663 \n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_12\">\n",
       "    <path d=\"M 412.499902 44.2832 \n",
       "L 412.499902 126.445663 \n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_13\">\n",
       "    <path d=\"M 135.882411 90.637199 \n",
       "L 135.882411 44.2832 \n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 74.463361 59.348249 \n",
       "L 104.593461 59.348249 \n",
       "L 104.593461 29.21815 \n",
       "L 74.463361 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_7\">\n",
       "    <path d=\"M 74.463361 105.702249 \n",
       "L 104.593461 105.702249 \n",
       "L 104.593461 75.572149 \n",
       "L 74.463361 75.572149 \n",
       "z\n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_8\">\n",
       "    <path d=\"M 135.882411 48.802714 \n",
       "C 137.081 48.802714 138.23066 48.32651 139.07819 47.478979 \n",
       "C 139.925721 46.631448 140.401926 45.481789 140.401926 44.2832 \n",
       "C 140.401926 43.08461 139.925721 41.934951 139.07819 41.08742 \n",
       "C 138.23066 40.239889 137.081 39.763685 135.882411 39.763685 \n",
       "C 134.683821 39.763685 133.534162 40.239889 132.686631 41.08742 \n",
       "C 131.8391 41.934951 131.362896 43.08461 131.362896 44.2832 \n",
       "C 131.362896 45.481789 131.8391 46.631448 132.686631 47.478979 \n",
       "C 133.534162 48.32651 134.683821 48.802714 135.882411 48.802714 \n",
       "z\n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_9\">\n",
       "    <path d=\"M 135.882411 95.156714 \n",
       "C 137.081 95.156714 138.23066 94.680509 139.07819 93.832979 \n",
       "C 139.925721 92.985448 140.401926 91.835788 140.401926 90.637199 \n",
       "C 140.401926 89.43861 139.925721 88.28895 139.07819 87.441419 \n",
       "C 138.23066 86.593889 137.081 86.117684 135.882411 86.117684 \n",
       "C 134.683821 86.117684 133.534162 86.593889 132.686631 87.441419 \n",
       "C 131.8391 88.28895 131.362896 89.43861 131.362896 90.637199 \n",
       "C 131.362896 91.835788 131.8391 92.985448 132.686631 93.832979 \n",
       "C 133.534162 94.680509 134.683821 95.156714 135.882411 95.156714 \n",
       "z\n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_10\">\n",
       "    <path d=\"M 167.17136 59.348249 \n",
       "L 197.30146 59.348249 \n",
       "L 197.30146 29.21815 \n",
       "L 167.17136 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: #bb8bff; stroke: #bb8bff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_11\">\n",
       "    <path d=\"M 213.52536 59.348249 \n",
       "L 243.655459 59.348249 \n",
       "L 243.655459 29.21815 \n",
       "L 213.52536 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_12\">\n",
       "    <path d=\"M 306.233358 59.348249 \n",
       "L 336.363458 59.348249 \n",
       "L 336.363458 29.21815 \n",
       "L 306.233358 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_13\">\n",
       "    <path d=\"M 331.843943 48.802714 \n",
       "C 331.843943 46.006937 330.73214 43.322808 328.755227 41.345895 \n",
       "C 326.778314 39.368982 324.094185 38.25718 321.298408 38.25718 \n",
       "C 318.502631 38.25718 315.818502 39.368982 313.841589 41.345895 \n",
       "C 311.864676 43.322808 310.752873 46.006937 310.752873 48.802714 \n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_14\">\n",
       "    <path d=\"M 321.298408 48.802714 \n",
       "L 331.843943 38.25718 \n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_14\">\n",
       "    <path d=\"M 367.652408 141.510713 \n",
       "C 368.850997 141.510713 370.000657 141.034509 370.848187 140.186978 \n",
       "C 371.695718 139.339447 372.171922 138.189788 372.171922 136.991198 \n",
       "C 372.171922 135.792609 371.695718 134.642949 370.848187 133.795419 \n",
       "C 370.000657 132.947888 368.850997 132.471683 367.652408 132.471683 \n",
       "C 366.453818 132.471683 365.304159 132.947888 364.456628 133.795419 \n",
       "C 363.609097 134.642949 363.132893 135.792609 363.132893 136.991198 \n",
       "C 363.132893 138.189788 363.609097 139.339447 364.456628 140.186978 \n",
       "C 365.304159 141.034509 366.453818 141.510713 367.652408 141.510713 \n",
       "z\n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_15\">\n",
       "    <path d=\"M 352.587358 105.702249 \n",
       "L 382.717457 105.702249 \n",
       "L 382.717457 75.572149 \n",
       "L 352.587358 75.572149 \n",
       "z\n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: #05bab6; stroke: #05bab6; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_16\">\n",
       "    <path d=\"M 398.941357 59.348249 \n",
       "L 429.071457 59.348249 \n",
       "L 429.071457 29.21815 \n",
       "L 398.941357 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_17\">\n",
       "    <path d=\"M 424.551942 48.802714 \n",
       "C 424.551942 46.006937 423.440139 43.322808 421.463226 41.345895 \n",
       "C 419.486313 39.368982 416.802184 38.25718 414.006407 38.25718 \n",
       "C 411.21063 38.25718 408.526501 39.368982 406.549588 41.345895 \n",
       "C 404.572675 43.322808 403.460872 46.006937 403.460872 48.802714 \n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_15\">\n",
       "    <path d=\"M 414.006407 48.802714 \n",
       "L 424.551942 38.25718 \n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"text_1\">\n",
       "    <g clip-path=\"url(#p4bc5c53613)\">\n",
       "     <!-- ${q}_{0}$ -->\n",
       "     <g transform=\"translate(37.188952 48.734176) scale(0.1625 -0.1625)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-Oblique-71\" d=\"M 2669 525 \n",
       "Q 2438 222 2123 65 \n",
       "Q 1809 -91 1428 -91 \n",
       "Q 897 -91 595 267 \n",
       "Q 294 625 294 1253 \n",
       "Q 294 1759 480 2231 \n",
       "Q 666 2703 1013 3078 \n",
       "Q 1238 3322 1530 3453 \n",
       "Q 1822 3584 2144 3584 \n",
       "Q 2531 3584 2781 3431 \n",
       "Q 3031 3278 3144 2969 \n",
       "L 3244 3494 \n",
       "L 3822 3494 \n",
       "L 2888 -1319 \n",
       "L 2309 -1319 \n",
       "L 2669 525 \n",
       "z\n",
       "M 891 1338 \n",
       "Q 891 875 1084 633 \n",
       "Q 1278 391 1644 391 \n",
       "Q 2188 391 2572 911 \n",
       "Q 2956 1431 2956 2175 \n",
       "Q 2956 2625 2757 2864 \n",
       "Q 2559 3103 2188 3103 \n",
       "Q 1916 3103 1684 2976 \n",
       "Q 1453 2850 1281 2606 \n",
       "Q 1100 2350 995 2006 \n",
       "Q 891 1663 891 1338 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \n",
       "Q 1547 4250 1301 3770 \n",
       "Q 1056 3291 1056 2328 \n",
       "Q 1056 1369 1301 889 \n",
       "Q 1547 409 2034 409 \n",
       "Q 2525 409 2770 889 \n",
       "Q 3016 1369 3016 2328 \n",
       "Q 3016 3291 2770 3770 \n",
       "Q 2525 4250 2034 4250 \n",
       "z\n",
       "M 2034 4750 \n",
       "Q 2819 4750 3233 4129 \n",
       "Q 3647 3509 3647 2328 \n",
       "Q 3647 1150 3233 529 \n",
       "Q 2819 -91 2034 -91 \n",
       "Q 1250 -91 836 529 \n",
       "Q 422 1150 422 2328 \n",
       "Q 422 3509 836 4129 \n",
       "Q 1250 4750 2034 4750 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-Oblique-71\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(63.476562 -16.40625) scale(0.7)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_2\">\n",
       "    <g clip-path=\"url(#p4bc5c53613)\">\n",
       "     <!-- ${q}_{1}$ -->\n",
       "     <g transform=\"translate(37.188952 95.088175) scale(0.1625 -0.1625)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-31\" d=\"M 794 531 \n",
       "L 1825 531 \n",
       "L 1825 4091 \n",
       "L 703 3866 \n",
       "L 703 4441 \n",
       "L 1819 4666 \n",
       "L 2450 4666 \n",
       "L 2450 531 \n",
       "L 3481 531 \n",
       "L 3481 0 \n",
       "L 794 0 \n",
       "L 794 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-Oblique-71\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(63.476562 -16.40625) scale(0.7)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_3\">\n",
       "    <g clip-path=\"url(#p4bc5c53613)\">\n",
       "     <!-- 2 -->\n",
       "     <g transform=\"translate(69.132651 130.192923) scale(0.104 -0.104)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-32\" d=\"M 1228 531 \n",
       "L 3431 531 \n",
       "L 3431 0 \n",
       "L 469 0 \n",
       "L 469 531 \n",
       "Q 828 903 1448 1529 \n",
       "Q 2069 2156 2228 2338 \n",
       "Q 2531 2678 2651 2914 \n",
       "Q 2772 3150 2772 3378 \n",
       "Q 2772 3750 2511 3984 \n",
       "Q 2250 4219 1831 4219 \n",
       "Q 1534 4219 1204 4116 \n",
       "Q 875 4013 500 3803 \n",
       "L 500 4441 \n",
       "Q 881 4594 1212 4672 \n",
       "Q 1544 4750 1819 4750 \n",
       "Q 2544 4750 2975 4387 \n",
       "Q 3406 4025 3406 3419 \n",
       "Q 3406 3131 3298 2873 \n",
       "Q 3191 2616 2906 2266 \n",
       "Q 2828 2175 2409 1742 \n",
       "Q 1991 1309 1228 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-32\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_4\">\n",
       "    <g clip-path=\"url(#p4bc5c53613)\">\n",
       "     <!-- c -->\n",
       "     <g transform=\"translate(46.291491 141.475183) scale(0.1625 -0.1625)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-63\" d=\"M 3122 3366 \n",
       "L 3122 2828 \n",
       "Q 2878 2963 2633 3030 \n",
       "Q 2388 3097 2138 3097 \n",
       "Q 1578 3097 1268 2742 \n",
       "Q 959 2388 959 1747 \n",
       "Q 959 1106 1268 751 \n",
       "Q 1578 397 2138 397 \n",
       "Q 2388 397 2633 464 \n",
       "Q 2878 531 3122 666 \n",
       "L 3122 134 \n",
       "Q 2881 22 2623 -34 \n",
       "Q 2366 -91 2075 -91 \n",
       "Q 1284 -91 818 406 \n",
       "Q 353 903 353 1747 \n",
       "Q 353 2603 823 3093 \n",
       "Q 1294 3584 2113 3584 \n",
       "Q 2378 3584 2631 3529 \n",
       "Q 2884 3475 3122 3366 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-63\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_5\">\n",
       "    <g clip-path=\"url(#p4bc5c53613)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(84.640208 47.870387) scale(0.13 -0.13)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-48\" d=\"M 628 4666 \n",
       "L 1259 4666 \n",
       "L 1259 2753 \n",
       "L 3553 2753 \n",
       "L 3553 4666 \n",
       "L 4184 4666 \n",
       "L 4184 0 \n",
       "L 3553 0 \n",
       "L 3553 2222 \n",
       "L 1259 2222 \n",
       "L 1259 0 \n",
       "L 628 0 \n",
       "L 628 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_6\">\n",
       "    <g clip-path=\"url(#p4bc5c53613)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(84.640208 94.224386) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_7\">\n",
       "    <g clip-path=\"url(#p4bc5c53613)\">\n",
       "     <!-- $-$1.05 -->\n",
       "     <g transform=\"translate(169.95641 55.529729) scale(0.08 -0.08)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-2212\" d=\"M 678 2272 \n",
       "L 4684 2272 \n",
       "L 4684 1741 \n",
       "L 678 1741 \n",
       "L 678 2272 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-2e\" d=\"M 684 794 \n",
       "L 1344 794 \n",
       "L 1344 0 \n",
       "L 684 0 \n",
       "L 684 794 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-35\" d=\"M 691 4666 \n",
       "L 3169 4666 \n",
       "L 3169 4134 \n",
       "L 1269 4134 \n",
       "L 1269 2991 \n",
       "Q 1406 3038 1543 3061 \n",
       "Q 1681 3084 1819 3084 \n",
       "Q 2600 3084 3056 2656 \n",
       "Q 3513 2228 3513 1497 \n",
       "Q 3513 744 3044 326 \n",
       "Q 2575 -91 1722 -91 \n",
       "Q 1428 -91 1123 -41 \n",
       "Q 819 9 494 109 \n",
       "L 494 744 \n",
       "Q 775 591 1075 516 \n",
       "Q 1375 441 1709 441 \n",
       "Q 2250 441 2565 725 \n",
       "Q 2881 1009 2881 1497 \n",
       "Q 2881 1984 2565 2268 \n",
       "Q 2250 2553 1709 2553 \n",
       "Q 1456 2553 1204 2497 \n",
       "Q 953 2441 691 2322 \n",
       "L 691 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-2212\" transform=\"translate(0 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(83.789062 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(147.412109 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(179.199219 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(242.822266 0.78125)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_8\">\n",
       "    <g clip-path=\"url(#p4bc5c53613)\">\n",
       "     <!-- P -->\n",
       "     <g transform=\"translate(178.317113 43.350872) scale(0.13 -0.13)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-50\" d=\"M 1259 4147 \n",
       "L 1259 2394 \n",
       "L 2053 2394 \n",
       "Q 2494 2394 2734 2622 \n",
       "Q 2975 2850 2975 3272 \n",
       "Q 2975 3691 2734 3919 \n",
       "Q 2494 4147 2053 4147 \n",
       "L 1259 4147 \n",
       "z\n",
       "M 628 4666 \n",
       "L 2053 4666 \n",
       "Q 2838 4666 3239 4311 \n",
       "Q 3641 3956 3641 3272 \n",
       "Q 3641 2581 3239 2228 \n",
       "Q 2838 1875 2053 1875 \n",
       "L 1259 1875 \n",
       "L 1259 0 \n",
       "L 628 0 \n",
       "L 628 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-50\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_9\">\n",
       "    <g clip-path=\"url(#p4bc5c53613)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(223.702206 47.870387) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_16\">\n",
       "    <path d=\"M 274.944409 21.1062 \n",
       "L 274.944409 67.460199 \n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: none; stroke-dasharray: 3.7,1.6; stroke-dashoffset: 0; stroke: #000000\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_17\">\n",
       "    <path d=\"M 274.944409 67.460199 \n",
       "L 274.944409 113.814199 \n",
       "\" clip-path=\"url(#p4bc5c53613)\" style=\"fill: none; stroke-dasharray: 3.7,1.6; stroke-dashoffset: 0; stroke: #000000\"/>\n",
       "   </g>\n",
       "   <g id=\"text_10\">\n",
       "    <g clip-path=\"url(#p4bc5c53613)\">\n",
       "     <!-- 0 -->\n",
       "     <g transform=\"translate(332.886908 130.192923) scale(0.104 -0.104)\">\n",
       "      <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_11\">\n",
       "    <g clip-path=\"url(#p4bc5c53613)\">\n",
       "     <!-- 0x1 -->\n",
       "     <g transform=\"translate(360.194908 152.108978) scale(0.08 -0.08)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-78\" d=\"M 3513 3500 \n",
       "L 2247 1797 \n",
       "L 3578 0 \n",
       "L 2900 0 \n",
       "L 1881 1375 \n",
       "L 863 0 \n",
       "L 184 0 \n",
       "L 1544 1831 \n",
       "L 300 3500 \n",
       "L 978 3500 \n",
       "L 1906 2253 \n",
       "L 2834 3500 \n",
       "L 3513 3500 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-78\" x=\"63.623047\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-31\" x=\"122.802734\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_12\">\n",
       "    <g clip-path=\"url(#p4bc5c53613)\">\n",
       "     <!-- X -->\n",
       "     <g transform=\"translate(363.199908 94.224386) scale(0.13 -0.13)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-58\" d=\"M 403 4666 \n",
       "L 1081 4666 \n",
       "L 2241 2931 \n",
       "L 3406 4666 \n",
       "L 4084 4666 \n",
       "L 2584 2425 \n",
       "L 4184 0 \n",
       "L 3506 0 \n",
       "L 2194 1984 \n",
       "L 872 0 \n",
       "L 191 0 \n",
       "L 1856 2491 \n",
       "L 403 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-58\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_13\">\n",
       "    <g clip-path=\"url(#p4bc5c53613)\">\n",
       "     <!-- 0 -->\n",
       "     <g transform=\"translate(425.594907 130.192923) scale(0.104 -0.104)\">\n",
       "      <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"p4bc5c53613\">\n",
       "   <rect x=\"7.2\" y=\"7.2\" width=\"437.400047\" height=\"157.603598\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 788.961x284.278 with 1 Axes>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# define the angle of Rz gate\n",
    "alpha = np.pi / 3\n",
    "cir = dq.QubitCircuit(2)\n",
    "\n",
    "# prepare cluster state\n",
    "cir.h(0)\n",
    "cir.h(1)\n",
    "cir.cz(0, 1)\n",
    "\n",
    "# |alpha> basis: apply phase shift and Hadamard gate\n",
    "cir.p(0, -alpha)\n",
    "cir.h(0)\n",
    "cir.barrier()\n",
    "\n",
    "cir.x(1, controls=0, condition=True)\n",
    "\n",
    "cir()\n",
    "\n",
    "# check the output state\n",
    "state, measure_rst, prob = cir.defer_measure(with_prob=True)\n",
    "# MBQC has an extra global phase: np.exp(-1j * alpha / 2)\n",
    "print(state * np.exp(1j * alpha / 2))\n",
    "print(cir.post_select(measure_rst) * np.exp(1j * alpha / 2)) # choose measurement result\n",
    "\n",
    "cir.draw()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "27cfa9a6",
   "metadata": {},
   "source": [
    "Verify single qubit operation $HR_z(-\\alpha)|+\\rangle$ in the circuit-based quantum computation (CBCQ)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "97b1021d",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-29T09:41:49.071206Z",
     "start_time": "2023-08-29T09:41:49.011408Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([[0.8660+0.0000j],\n",
      "        [0.0000+0.5000j]])\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"209.923024pt\" height=\"79.295599pt\" viewBox=\"0 0 209.923024 79.295599\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2023-08-30T13:21:29.777935</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.7.2, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 79.295599 \n",
       "L 209.923024 79.295599 \n",
       "L 209.923024 0 \n",
       "L 0 0 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"line2d_1\">\n",
       "    <path d=\"M 54.390226 44.2832 \n",
       "L 198.087624 44.2832 \n",
       "\" clip-path=\"url(#p50a7e80b8c)\" style=\"fill: none; stroke: #000000; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 64.356335 59.348249 \n",
       "L 94.486435 59.348249 \n",
       "L 94.486435 29.21815 \n",
       "L 64.356335 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#p50a7e80b8c)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 110.710335 59.348249 \n",
       "L 140.840434 59.348249 \n",
       "L 140.840434 29.21815 \n",
       "L 110.710335 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#p50a7e80b8c)\" style=\"fill: #bb8bff; stroke: #bb8bff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 157.064334 59.348249 \n",
       "L 187.194434 59.348249 \n",
       "L 187.194434 29.21815 \n",
       "L 157.064334 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#p50a7e80b8c)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"text_1\">\n",
       "    <g clip-path=\"url(#p50a7e80b8c)\">\n",
       "     <!-- ${q}$ -->\n",
       "     <g transform=\"translate(34.719426 48.734176) scale(0.1625 -0.1625)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-Oblique-71\" d=\"M 2669 525 \n",
       "Q 2438 222 2123 65 \n",
       "Q 1809 -91 1428 -91 \n",
       "Q 897 -91 595 267 \n",
       "Q 294 625 294 1253 \n",
       "Q 294 1759 480 2231 \n",
       "Q 666 2703 1013 3078 \n",
       "Q 1238 3322 1530 3453 \n",
       "Q 1822 3584 2144 3584 \n",
       "Q 2531 3584 2781 3431 \n",
       "Q 3031 3278 3144 2969 \n",
       "L 3244 3494 \n",
       "L 3822 3494 \n",
       "L 2888 -1319 \n",
       "L 2309 -1319 \n",
       "L 2669 525 \n",
       "z\n",
       "M 891 1338 \n",
       "Q 891 875 1084 633 \n",
       "Q 1278 391 1644 391 \n",
       "Q 2188 391 2572 911 \n",
       "Q 2956 1431 2956 2175 \n",
       "Q 2956 2625 2757 2864 \n",
       "Q 2559 3103 2188 3103 \n",
       "Q 1916 3103 1684 2976 \n",
       "Q 1453 2850 1281 2606 \n",
       "Q 1100 2350 995 2006 \n",
       "Q 891 1663 891 1338 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-Oblique-71\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_2\">\n",
       "    <g clip-path=\"url(#p50a7e80b8c)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(74.533182 47.870387) scale(0.13 -0.13)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-48\" d=\"M 628 4666 \n",
       "L 1259 4666 \n",
       "L 1259 2753 \n",
       "L 3553 2753 \n",
       "L 3553 4666 \n",
       "L 4184 4666 \n",
       "L 4184 0 \n",
       "L 3553 0 \n",
       "L 3553 2222 \n",
       "L 1259 2222 \n",
       "L 1259 0 \n",
       "L 628 0 \n",
       "L 628 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_3\">\n",
       "    <g clip-path=\"url(#p50a7e80b8c)\">\n",
       "     <!-- $-$1.05 -->\n",
       "     <g transform=\"translate(113.495385 55.529729) scale(0.08 -0.08)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-2212\" d=\"M 678 2272 \n",
       "L 4684 2272 \n",
       "L 4684 1741 \n",
       "L 678 1741 \n",
       "L 678 2272 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-31\" d=\"M 794 531 \n",
       "L 1825 531 \n",
       "L 1825 4091 \n",
       "L 703 3866 \n",
       "L 703 4441 \n",
       "L 1819 4666 \n",
       "L 2450 4666 \n",
       "L 2450 531 \n",
       "L 3481 531 \n",
       "L 3481 0 \n",
       "L 794 0 \n",
       "L 794 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-2e\" d=\"M 684 794 \n",
       "L 1344 794 \n",
       "L 1344 0 \n",
       "L 684 0 \n",
       "L 684 794 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \n",
       "Q 1547 4250 1301 3770 \n",
       "Q 1056 3291 1056 2328 \n",
       "Q 1056 1369 1301 889 \n",
       "Q 1547 409 2034 409 \n",
       "Q 2525 409 2770 889 \n",
       "Q 3016 1369 3016 2328 \n",
       "Q 3016 3291 2770 3770 \n",
       "Q 2525 4250 2034 4250 \n",
       "z\n",
       "M 2034 4750 \n",
       "Q 2819 4750 3233 4129 \n",
       "Q 3647 3509 3647 2328 \n",
       "Q 3647 1150 3233 529 \n",
       "Q 2819 -91 2034 -91 \n",
       "Q 1250 -91 836 529 \n",
       "Q 422 1150 422 2328 \n",
       "Q 422 3509 836 4129 \n",
       "Q 1250 4750 2034 4750 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-35\" d=\"M 691 4666 \n",
       "L 3169 4666 \n",
       "L 3169 4134 \n",
       "L 1269 4134 \n",
       "L 1269 2991 \n",
       "Q 1406 3038 1543 3061 \n",
       "Q 1681 3084 1819 3084 \n",
       "Q 2600 3084 3056 2656 \n",
       "Q 3513 2228 3513 1497 \n",
       "Q 3513 744 3044 326 \n",
       "Q 2575 -91 1722 -91 \n",
       "Q 1428 -91 1123 -41 \n",
       "Q 819 9 494 109 \n",
       "L 494 744 \n",
       "Q 775 591 1075 516 \n",
       "Q 1375 441 1709 441 \n",
       "Q 2250 441 2565 725 \n",
       "Q 2881 1009 2881 1497 \n",
       "Q 2881 1984 2565 2268 \n",
       "Q 2250 2553 1709 2553 \n",
       "Q 1456 2553 1204 2497 \n",
       "Q 953 2441 691 2322 \n",
       "L 691 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-2212\" transform=\"translate(0 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(83.789062 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(147.412109 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(179.199219 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(242.822266 0.78125)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_4\">\n",
       "    <g clip-path=\"url(#p50a7e80b8c)\">\n",
       "     <!-- $\\mathrm{R_Z}$ -->\n",
       "     <g transform=\"translate(117.845385 43.350872) scale(0.13 -0.13)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-52\" d=\"M 2841 2188 \n",
       "Q 3044 2119 3236 1894 \n",
       "Q 3428 1669 3622 1275 \n",
       "L 4263 0 \n",
       "L 3584 0 \n",
       "L 2988 1197 \n",
       "Q 2756 1666 2539 1819 \n",
       "Q 2322 1972 1947 1972 \n",
       "L 1259 1972 \n",
       "L 1259 0 \n",
       "L 628 0 \n",
       "L 628 4666 \n",
       "L 2053 4666 \n",
       "Q 2853 4666 3247 4331 \n",
       "Q 3641 3997 3641 3322 \n",
       "Q 3641 2881 3436 2590 \n",
       "Q 3231 2300 2841 2188 \n",
       "z\n",
       "M 1259 4147 \n",
       "L 1259 2491 \n",
       "L 2053 2491 \n",
       "Q 2509 2491 2742 2702 \n",
       "Q 2975 2913 2975 3322 \n",
       "Q 2975 3731 2742 3939 \n",
       "Q 2509 4147 2053 4147 \n",
       "L 1259 4147 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-5a\" d=\"M 359 4666 \n",
       "L 4025 4666 \n",
       "L 4025 4184 \n",
       "L 1075 531 \n",
       "L 4097 531 \n",
       "L 4097 0 \n",
       "L 288 0 \n",
       "L 288 481 \n",
       "L 3238 4134 \n",
       "L 359 4134 \n",
       "L 359 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-52\" transform=\"translate(0 0.09375)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-5a\" transform=\"translate(70.439453 -16.3125) scale(0.7)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_5\">\n",
       "    <g clip-path=\"url(#p50a7e80b8c)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(167.241181 47.870387) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"p50a7e80b8c\">\n",
       "   <rect x=\"7.2\" y=\"7.2\" width=\"195.523024\" height=\"64.895599\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 352.675x117.056 with 1 Axes>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cir = dq.QubitCircuit(1)\n",
    "# prepare state |+>\n",
    "cir.h(0)\n",
    "\n",
    "# apply Rz and Hadamard gate\n",
    "cir.rz(0, -alpha)\n",
    "cir.h(0)\n",
    "\n",
    "print(cir())\n",
    "cir.draw()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4cce74ed",
   "metadata": {},
   "source": [
    "## Random single-qubit-rotation gate"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fb4d474a",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-29T05:26:07.663803Z",
     "start_time": "2023-08-29T05:26:07.636876Z"
    }
   },
   "source": [
    "对于任意单比特门的实现，采用三个H-Rz gate级联的形式，最后根据测量结果加上对应的Pauli修正\n",
    "\n",
    "![MBQC example](./figure/basic_gate_MBQC/Single.jpg)\n",
    "<div style=\"text-align:center\">图 2: MBQC single gate 的实现</div>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "4364a5c8",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-29T09:40:58.419902Z",
     "start_time": "2023-08-29T09:40:58.149805Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The probability of deferred measurement to get \"001\" is 0.12499997019767761.\n",
      "tensor([[0.3314+0.4619j, 0.1913+0.8001j]])\n",
      "tensor([[0.3314+0.4619j, 0.1913+0.8001j]])\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"822.743986pt\" height=\"264.711597pt\" viewBox=\"0 0 822.743986 264.711597\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2023-08-30T13:21:30.302190</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.7.2, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 264.711597 \n",
       "L 822.743986 264.711597 \n",
       "L 822.743986 0 \n",
       "L 0 0 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 408.092332 219.153662 \n",
       "L 420.144372 219.153662 \n",
       "L 414.118352 227.845037 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #778899\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 500.800331 219.153662 \n",
       "L 512.852371 219.153662 \n",
       "L 506.826351 227.845037 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #778899\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 593.508329 219.153662 \n",
       "L 605.560369 219.153662 \n",
       "L 599.534349 227.845037 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #778899\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 686.216328 219.153662 \n",
       "L 698.268368 219.153662 \n",
       "L 692.242348 227.845037 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #778899\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 732.570328 219.153662 \n",
       "L 744.622367 219.153662 \n",
       "L 738.596348 227.845037 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #778899\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_7\">\n",
       "    <path d=\"M 778.924327 219.153662 \n",
       "L 790.976367 219.153662 \n",
       "L 784.950347 227.845037 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #778899\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_1\">\n",
       "    <path d=\"M 64.609196 44.2832 \n",
       "L 810.908587 44.2832 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #000000; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_2\">\n",
       "    <path d=\"M 64.609196 90.637199 \n",
       "L 810.908587 90.637199 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #000000; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_3\">\n",
       "    <path d=\"M 64.609196 136.991198 \n",
       "L 810.908587 136.991198 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #000000; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_4\">\n",
       "    <path d=\"M 64.609196 183.345198 \n",
       "L 810.908587 183.345198 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #000000; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_5\">\n",
       "    <path d=\"M 64.609196 228.192692 \n",
       "L 810.908587 228.192692 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_6\">\n",
       "    <path d=\"M 64.609196 231.205702 \n",
       "L 810.908587 231.205702 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_7\">\n",
       "    <path d=\"M 73.879996 234.334597 \n",
       "L 78.515396 225.063797 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 1.5; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_8\">\n",
       "    <path d=\"M 135.994356 90.637199 \n",
       "L 135.994356 44.2832 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_9\">\n",
       "    <path d=\"M 182.348355 136.991198 \n",
       "L 182.348355 90.637199 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_10\">\n",
       "    <path d=\"M 228.702354 183.345198 \n",
       "L 228.702354 136.991198 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_8\">\n",
       "    <path d=\"M 266.017324 67.460199 \n",
       "L 284.095384 67.460199 \n",
       "L 284.095384 21.1062 \n",
       "L 266.017324 21.1062 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #bdbdbd; opacity: 0.6\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_9\">\n",
       "    <path d=\"M 266.017324 113.814199 \n",
       "L 284.095384 113.814199 \n",
       "L 284.095384 67.460199 \n",
       "L 266.017324 67.460199 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #bdbdbd; opacity: 0.6\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_10\">\n",
       "    <path d=\"M 266.017324 160.168198 \n",
       "L 284.095384 160.168198 \n",
       "L 284.095384 113.814199 \n",
       "L 266.017324 113.814199 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #bdbdbd; opacity: 0.6\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_11\">\n",
       "    <path d=\"M 266.017324 206.522197 \n",
       "L 284.095384 206.522197 \n",
       "L 284.095384 160.168198 \n",
       "L 266.017324 160.168198 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #bdbdbd; opacity: 0.6\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_11\">\n",
       "    <path d=\"M 415.624857 136.991198 \n",
       "L 415.624857 219.153662 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_12\">\n",
       "    <path d=\"M 412.611847 136.991198 \n",
       "L 412.611847 219.153662 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_13\">\n",
       "    <path d=\"M 461.978856 183.345198 \n",
       "L 461.978856 229.699197 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_14\">\n",
       "    <path d=\"M 458.965846 183.345198 \n",
       "L 458.965846 229.699197 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_15\">\n",
       "    <path d=\"M 508.332856 90.637199 \n",
       "L 508.332856 219.153662 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_16\">\n",
       "    <path d=\"M 505.319846 90.637199 \n",
       "L 505.319846 219.153662 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_17\">\n",
       "    <path d=\"M 554.686855 183.345198 \n",
       "L 554.686855 229.699197 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_18\">\n",
       "    <path d=\"M 551.673845 183.345198 \n",
       "L 551.673845 229.699197 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_19\">\n",
       "    <path d=\"M 601.040854 44.2832 \n",
       "L 601.040854 219.153662 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_20\">\n",
       "    <path d=\"M 598.027844 44.2832 \n",
       "L 598.027844 219.153662 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_21\">\n",
       "    <path d=\"M 647.394854 183.345198 \n",
       "L 647.394854 229.699197 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_22\">\n",
       "    <path d=\"M 644.381844 183.345198 \n",
       "L 644.381844 229.699197 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_23\">\n",
       "    <path d=\"M 693.748853 44.2832 \n",
       "L 693.748853 219.153662 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_24\">\n",
       "    <path d=\"M 690.735843 44.2832 \n",
       "L 690.735843 219.153662 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_25\">\n",
       "    <path d=\"M 740.102852 90.637199 \n",
       "L 740.102852 219.153662 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_26\">\n",
       "    <path d=\"M 737.089843 90.637199 \n",
       "L 737.089843 219.153662 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_27\">\n",
       "    <path d=\"M 786.456852 136.991198 \n",
       "L 786.456852 219.153662 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_28\">\n",
       "    <path d=\"M 783.443842 136.991198 \n",
       "L 783.443842 219.153662 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_29\">\n",
       "    <path d=\"M 135.994356 90.637199 \n",
       "L 135.994356 44.2832 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_30\">\n",
       "    <path d=\"M 182.348355 136.991198 \n",
       "L 182.348355 90.637199 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_31\">\n",
       "    <path d=\"M 228.702354 183.345198 \n",
       "L 228.702354 136.991198 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_12\">\n",
       "    <path d=\"M 74.575306 59.348249 \n",
       "L 104.705406 59.348249 \n",
       "L 104.705406 29.21815 \n",
       "L 74.575306 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_13\">\n",
       "    <path d=\"M 74.575306 105.702249 \n",
       "L 104.705406 105.702249 \n",
       "L 104.705406 75.572149 \n",
       "L 74.575306 75.572149 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_14\">\n",
       "    <path d=\"M 74.575306 152.056248 \n",
       "L 104.705406 152.056248 \n",
       "L 104.705406 121.926148 \n",
       "L 74.575306 121.926148 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_15\">\n",
       "    <path d=\"M 74.575306 198.410247 \n",
       "L 104.705406 198.410247 \n",
       "L 104.705406 168.280148 \n",
       "L 74.575306 168.280148 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_16\">\n",
       "    <path d=\"M 135.994356 48.802714 \n",
       "C 137.192945 48.802714 138.342605 48.32651 139.190135 47.478979 \n",
       "C 140.037666 46.631448 140.51387 45.481789 140.51387 44.2832 \n",
       "C 140.51387 43.08461 140.037666 41.934951 139.190135 41.08742 \n",
       "C 138.342605 40.239889 137.192945 39.763685 135.994356 39.763685 \n",
       "C 134.795766 39.763685 133.646107 40.239889 132.798576 41.08742 \n",
       "C 131.951045 41.934951 131.474841 43.08461 131.474841 44.2832 \n",
       "C 131.474841 45.481789 131.951045 46.631448 132.798576 47.478979 \n",
       "C 133.646107 48.32651 134.795766 48.802714 135.994356 48.802714 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_17\">\n",
       "    <path d=\"M 135.994356 95.156714 \n",
       "C 137.192945 95.156714 138.342605 94.680509 139.190135 93.832979 \n",
       "C 140.037666 92.985448 140.51387 91.835788 140.51387 90.637199 \n",
       "C 140.51387 89.43861 140.037666 88.28895 139.190135 87.441419 \n",
       "C 138.342605 86.593889 137.192945 86.117684 135.994356 86.117684 \n",
       "C 134.795766 86.117684 133.646107 86.593889 132.798576 87.441419 \n",
       "C 131.951045 88.28895 131.474841 89.43861 131.474841 90.637199 \n",
       "C 131.474841 91.835788 131.951045 92.985448 132.798576 93.832979 \n",
       "C 133.646107 94.680509 134.795766 95.156714 135.994356 95.156714 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_18\">\n",
       "    <path d=\"M 182.348355 95.156714 \n",
       "C 183.546944 95.156714 184.696604 94.680509 185.544135 93.832979 \n",
       "C 186.391665 92.985448 186.86787 91.835788 186.86787 90.637199 \n",
       "C 186.86787 89.43861 186.391665 88.28895 185.544135 87.441419 \n",
       "C 184.696604 86.593889 183.546944 86.117684 182.348355 86.117684 \n",
       "C 181.149766 86.117684 180.000106 86.593889 179.152575 87.441419 \n",
       "C 178.305045 88.28895 177.82884 89.43861 177.82884 90.637199 \n",
       "C 177.82884 91.835788 178.305045 92.985448 179.152575 93.832979 \n",
       "C 180.000106 94.680509 181.149766 95.156714 182.348355 95.156714 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_19\">\n",
       "    <path d=\"M 182.348355 141.510713 \n",
       "C 183.546944 141.510713 184.696604 141.034509 185.544135 140.186978 \n",
       "C 186.391665 139.339447 186.86787 138.189788 186.86787 136.991198 \n",
       "C 186.86787 135.792609 186.391665 134.642949 185.544135 133.795419 \n",
       "C 184.696604 132.947888 183.546944 132.471683 182.348355 132.471683 \n",
       "C 181.149766 132.471683 180.000106 132.947888 179.152575 133.795419 \n",
       "C 178.305045 134.642949 177.82884 135.792609 177.82884 136.991198 \n",
       "C 177.82884 138.189788 178.305045 139.339447 179.152575 140.186978 \n",
       "C 180.000106 141.034509 181.149766 141.510713 182.348355 141.510713 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_20\">\n",
       "    <path d=\"M 228.702354 141.510713 \n",
       "C 229.900944 141.510713 231.050603 141.034509 231.898134 140.186978 \n",
       "C 232.745665 139.339447 233.221869 138.189788 233.221869 136.991198 \n",
       "C 233.221869 135.792609 232.745665 134.642949 231.898134 133.795419 \n",
       "C 231.050603 132.947888 229.900944 132.471683 228.702354 132.471683 \n",
       "C 227.503765 132.471683 226.354105 132.947888 225.506575 133.795419 \n",
       "C 224.659044 134.642949 224.182839 135.792609 224.182839 136.991198 \n",
       "C 224.182839 138.189788 224.659044 139.339447 225.506575 140.186978 \n",
       "C 226.354105 141.034509 227.503765 141.510713 228.702354 141.510713 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_21\">\n",
       "    <path d=\"M 228.702354 187.864713 \n",
       "C 229.900944 187.864713 231.050603 187.388508 231.898134 186.540977 \n",
       "C 232.745665 185.693447 233.221869 184.543787 233.221869 183.345198 \n",
       "C 233.221869 182.146608 232.745665 180.996949 231.898134 180.149418 \n",
       "C 231.050603 179.301887 229.900944 178.825683 228.702354 178.825683 \n",
       "C 227.503765 178.825683 226.354105 179.301887 225.506575 180.149418 \n",
       "C 224.659044 180.996949 224.182839 182.146608 224.182839 183.345198 \n",
       "C 224.182839 184.543787 224.659044 185.693447 225.506575 186.540977 \n",
       "C 226.354105 187.388508 227.503765 187.864713 228.702354 187.864713 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_22\">\n",
       "    <path d=\"M 306.345303 59.348249 \n",
       "L 336.475403 59.348249 \n",
       "L 336.475403 29.21815 \n",
       "L 306.345303 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #bb8bff; stroke: #bb8bff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_23\">\n",
       "    <path d=\"M 306.345303 105.702249 \n",
       "L 336.475403 105.702249 \n",
       "L 336.475403 75.572149 \n",
       "L 306.345303 75.572149 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #bb8bff; stroke: #bb8bff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_24\">\n",
       "    <path d=\"M 305.473848 152.056248 \n",
       "L 337.346858 152.056248 \n",
       "L 337.346858 121.926148 \n",
       "L 305.473848 121.926148 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #bb8bff; stroke: #bb8bff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_25\">\n",
       "    <path d=\"M 352.699303 59.348249 \n",
       "L 382.829402 59.348249 \n",
       "L 382.829402 29.21815 \n",
       "L 352.699303 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_26\">\n",
       "    <path d=\"M 352.699303 105.702249 \n",
       "L 382.829402 105.702249 \n",
       "L 382.829402 75.572149 \n",
       "L 352.699303 75.572149 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_27\">\n",
       "    <path d=\"M 352.699303 152.056248 \n",
       "L 382.829402 152.056248 \n",
       "L 382.829402 121.926148 \n",
       "L 352.699303 121.926148 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_28\">\n",
       "    <path d=\"M 399.053302 152.056248 \n",
       "L 429.183402 152.056248 \n",
       "L 429.183402 121.926148 \n",
       "L 399.053302 121.926148 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_29\">\n",
       "    <path d=\"M 424.663887 141.510713 \n",
       "C 424.663887 138.714936 423.552084 136.030807 421.575171 134.053894 \n",
       "C 419.598258 132.076981 416.914129 130.965178 414.118352 130.965178 \n",
       "C 411.322575 130.965178 408.638446 132.076981 406.661533 134.053894 \n",
       "C 404.68462 136.030807 403.572817 138.714936 403.572817 141.510713 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_32\">\n",
       "    <path d=\"M 414.118352 141.510713 \n",
       "L 424.663887 130.965178 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_30\">\n",
       "    <path d=\"M 460.472351 234.218712 \n",
       "C 461.670941 234.218712 462.8206 233.742507 463.668131 232.894977 \n",
       "C 464.515662 232.047446 464.991866 230.897786 464.991866 229.699197 \n",
       "C 464.991866 228.500608 464.515662 227.350948 463.668131 226.503417 \n",
       "C 462.8206 225.655887 461.670941 225.179682 460.472351 225.179682 \n",
       "C 459.273762 225.179682 458.124102 225.655887 457.276572 226.503417 \n",
       "C 456.429041 227.350948 455.952836 228.500608 455.952836 229.699197 \n",
       "C 455.952836 230.897786 456.429041 232.047446 457.276572 232.894977 \n",
       "C 458.124102 233.742507 459.273762 234.218712 460.472351 234.218712 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_31\">\n",
       "    <path d=\"M 445.407301 198.410247 \n",
       "L 475.537401 198.410247 \n",
       "L 475.537401 168.280148 \n",
       "L 445.407301 168.280148 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #05bab6; stroke: #05bab6; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_32\">\n",
       "    <path d=\"M 491.761301 105.702249 \n",
       "L 521.8914 105.702249 \n",
       "L 521.8914 75.572149 \n",
       "L 491.761301 75.572149 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_33\">\n",
       "    <path d=\"M 517.371885 95.156714 \n",
       "C 517.371885 92.360937 516.260083 89.676808 514.28317 87.699895 \n",
       "C 512.306257 85.722982 509.622128 84.611179 506.826351 84.611179 \n",
       "C 504.030574 84.611179 501.346444 85.722982 499.369531 87.699895 \n",
       "C 497.392618 89.676808 496.280816 92.360937 496.280816 95.156714 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_33\">\n",
       "    <path d=\"M 506.826351 95.156714 \n",
       "L 517.371885 84.611179 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_34\">\n",
       "    <path d=\"M 553.18035 234.218712 \n",
       "C 554.378939 234.218712 555.528599 233.742507 556.37613 232.894977 \n",
       "C 557.22366 232.047446 557.699865 230.897786 557.699865 229.699197 \n",
       "C 557.699865 228.500608 557.22366 227.350948 556.37613 226.503417 \n",
       "C 555.528599 225.655887 554.378939 225.179682 553.18035 225.179682 \n",
       "C 551.981761 225.179682 550.832101 225.655887 549.98457 226.503417 \n",
       "C 549.13704 227.350948 548.660835 228.500608 548.660835 229.699197 \n",
       "C 548.660835 230.897786 549.13704 232.047446 549.98457 232.894977 \n",
       "C 550.832101 233.742507 551.981761 234.218712 553.18035 234.218712 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_35\">\n",
       "    <path d=\"M 538.1153 198.410247 \n",
       "L 568.2454 198.410247 \n",
       "L 568.2454 168.280148 \n",
       "L 538.1153 168.280148 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #05bab6; stroke: #05bab6; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_36\">\n",
       "    <path d=\"M 584.4693 59.348249 \n",
       "L 614.599399 59.348249 \n",
       "L 614.599399 29.21815 \n",
       "L 584.4693 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_37\">\n",
       "    <path d=\"M 610.079884 48.802714 \n",
       "C 610.079884 46.006937 608.968082 43.322808 606.991169 41.345895 \n",
       "C 605.014256 39.368982 602.330126 38.25718 599.534349 38.25718 \n",
       "C 596.738572 38.25718 594.054443 39.368982 592.07753 41.345895 \n",
       "C 590.100617 43.322808 588.988814 46.006937 588.988814 48.802714 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_34\">\n",
       "    <path d=\"M 599.534349 48.802714 \n",
       "L 610.079884 38.25718 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_38\">\n",
       "    <path d=\"M 645.888349 234.218712 \n",
       "C 647.086938 234.218712 648.236598 233.742507 649.084128 232.894977 \n",
       "C 649.931659 232.047446 650.407864 230.897786 650.407864 229.699197 \n",
       "C 650.407864 228.500608 649.931659 227.350948 649.084128 226.503417 \n",
       "C 648.236598 225.655887 647.086938 225.179682 645.888349 225.179682 \n",
       "C 644.689759 225.179682 643.5401 225.655887 642.692569 226.503417 \n",
       "C 641.845038 227.350948 641.368834 228.500608 641.368834 229.699197 \n",
       "C 641.368834 230.897786 641.845038 232.047446 642.692569 232.894977 \n",
       "C 643.5401 233.742507 644.689759 234.218712 645.888349 234.218712 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_39\">\n",
       "    <path d=\"M 630.823299 198.410247 \n",
       "L 660.953399 198.410247 \n",
       "L 660.953399 168.280148 \n",
       "L 630.823299 168.280148 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: #05bab6; stroke: #05bab6; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_40\">\n",
       "    <path d=\"M 677.177298 59.348249 \n",
       "L 707.307398 59.348249 \n",
       "L 707.307398 29.21815 \n",
       "L 677.177298 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_41\">\n",
       "    <path d=\"M 702.787883 48.802714 \n",
       "C 702.787883 46.006937 701.67608 43.322808 699.699167 41.345895 \n",
       "C 697.722254 39.368982 695.038125 38.25718 692.242348 38.25718 \n",
       "C 689.446571 38.25718 686.762442 39.368982 684.785529 41.345895 \n",
       "C 682.808616 43.322808 681.696813 46.006937 681.696813 48.802714 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_35\">\n",
       "    <path d=\"M 692.242348 48.802714 \n",
       "L 702.787883 38.25718 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_42\">\n",
       "    <path d=\"M 723.531298 105.702249 \n",
       "L 753.661397 105.702249 \n",
       "L 753.661397 75.572149 \n",
       "L 723.531298 75.572149 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_43\">\n",
       "    <path d=\"M 749.141882 95.156714 \n",
       "C 749.141882 92.360937 748.03008 89.676808 746.053167 87.699895 \n",
       "C 744.076254 85.722982 741.392125 84.611179 738.596348 84.611179 \n",
       "C 735.80057 84.611179 733.116441 85.722982 731.139528 87.699895 \n",
       "C 729.162615 89.676808 728.050813 92.360937 728.050813 95.156714 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_36\">\n",
       "    <path d=\"M 738.596348 95.156714 \n",
       "L 749.141882 84.611179 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_44\">\n",
       "    <path d=\"M 769.885297 152.056248 \n",
       "L 800.015397 152.056248 \n",
       "L 800.015397 121.926148 \n",
       "L 769.885297 121.926148 \n",
       "z\n",
       "\" clip-path=\"url(#pa690307720)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_45\">\n",
       "    <path d=\"M 795.495882 141.510713 \n",
       "C 795.495882 138.714936 794.384079 136.030807 792.407166 134.053894 \n",
       "C 790.430253 132.076981 787.746124 130.965178 784.950347 130.965178 \n",
       "C 782.15457 130.965178 779.470441 132.076981 777.493528 134.053894 \n",
       "C 775.516615 136.030807 774.404812 138.714936 774.404812 141.510713 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_37\">\n",
       "    <path d=\"M 784.950347 141.510713 \n",
       "L 795.495882 130.965178 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"text_1\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- ${q}_{0}$ -->\n",
       "     <g transform=\"translate(37.300897 48.734176) scale(0.1625 -0.1625)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-Oblique-71\" d=\"M 2669 525 \n",
       "Q 2438 222 2123 65 \n",
       "Q 1809 -91 1428 -91 \n",
       "Q 897 -91 595 267 \n",
       "Q 294 625 294 1253 \n",
       "Q 294 1759 480 2231 \n",
       "Q 666 2703 1013 3078 \n",
       "Q 1238 3322 1530 3453 \n",
       "Q 1822 3584 2144 3584 \n",
       "Q 2531 3584 2781 3431 \n",
       "Q 3031 3278 3144 2969 \n",
       "L 3244 3494 \n",
       "L 3822 3494 \n",
       "L 2888 -1319 \n",
       "L 2309 -1319 \n",
       "L 2669 525 \n",
       "z\n",
       "M 891 1338 \n",
       "Q 891 875 1084 633 \n",
       "Q 1278 391 1644 391 \n",
       "Q 2188 391 2572 911 \n",
       "Q 2956 1431 2956 2175 \n",
       "Q 2956 2625 2757 2864 \n",
       "Q 2559 3103 2188 3103 \n",
       "Q 1916 3103 1684 2976 \n",
       "Q 1453 2850 1281 2606 \n",
       "Q 1100 2350 995 2006 \n",
       "Q 891 1663 891 1338 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \n",
       "Q 1547 4250 1301 3770 \n",
       "Q 1056 3291 1056 2328 \n",
       "Q 1056 1369 1301 889 \n",
       "Q 1547 409 2034 409 \n",
       "Q 2525 409 2770 889 \n",
       "Q 3016 1369 3016 2328 \n",
       "Q 3016 3291 2770 3770 \n",
       "Q 2525 4250 2034 4250 \n",
       "z\n",
       "M 2034 4750 \n",
       "Q 2819 4750 3233 4129 \n",
       "Q 3647 3509 3647 2328 \n",
       "Q 3647 1150 3233 529 \n",
       "Q 2819 -91 2034 -91 \n",
       "Q 1250 -91 836 529 \n",
       "Q 422 1150 422 2328 \n",
       "Q 422 3509 836 4129 \n",
       "Q 1250 4750 2034 4750 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-Oblique-71\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(63.476562 -16.40625) scale(0.7)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_2\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- ${q}_{1}$ -->\n",
       "     <g transform=\"translate(37.300897 95.088175) scale(0.1625 -0.1625)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-31\" d=\"M 794 531 \n",
       "L 1825 531 \n",
       "L 1825 4091 \n",
       "L 703 3866 \n",
       "L 703 4441 \n",
       "L 1819 4666 \n",
       "L 2450 4666 \n",
       "L 2450 531 \n",
       "L 3481 531 \n",
       "L 3481 0 \n",
       "L 794 0 \n",
       "L 794 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-Oblique-71\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(63.476562 -16.40625) scale(0.7)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_3\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- ${q}_{2}$ -->\n",
       "     <g transform=\"translate(37.300897 141.442175) scale(0.1625 -0.1625)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-32\" d=\"M 1228 531 \n",
       "L 3431 531 \n",
       "L 3431 0 \n",
       "L 469 0 \n",
       "L 469 531 \n",
       "Q 828 903 1448 1529 \n",
       "Q 2069 2156 2228 2338 \n",
       "Q 2531 2678 2651 2914 \n",
       "Q 2772 3150 2772 3378 \n",
       "Q 2772 3750 2511 3984 \n",
       "Q 2250 4219 1831 4219 \n",
       "Q 1534 4219 1204 4116 \n",
       "Q 875 4013 500 3803 \n",
       "L 500 4441 \n",
       "Q 881 4594 1212 4672 \n",
       "Q 1544 4750 1819 4750 \n",
       "Q 2544 4750 2975 4387 \n",
       "Q 3406 4025 3406 3419 \n",
       "Q 3406 3131 3298 2873 \n",
       "Q 3191 2616 2906 2266 \n",
       "Q 2828 2175 2409 1742 \n",
       "Q 1991 1309 1228 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-Oblique-71\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(63.476562 -16.40625) scale(0.7)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_4\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- ${q}_{3}$ -->\n",
       "     <g transform=\"translate(37.300897 187.796174) scale(0.1625 -0.1625)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-33\" d=\"M 2597 2516 \n",
       "Q 3050 2419 3304 2112 \n",
       "Q 3559 1806 3559 1356 \n",
       "Q 3559 666 3084 287 \n",
       "Q 2609 -91 1734 -91 \n",
       "Q 1441 -91 1130 -33 \n",
       "Q 819 25 488 141 \n",
       "L 488 750 \n",
       "Q 750 597 1062 519 \n",
       "Q 1375 441 1716 441 \n",
       "Q 2309 441 2620 675 \n",
       "Q 2931 909 2931 1356 \n",
       "Q 2931 1769 2642 2001 \n",
       "Q 2353 2234 1838 2234 \n",
       "L 1294 2234 \n",
       "L 1294 2753 \n",
       "L 1863 2753 \n",
       "Q 2328 2753 2575 2939 \n",
       "Q 2822 3125 2822 3475 \n",
       "Q 2822 3834 2567 4026 \n",
       "Q 2313 4219 1838 4219 \n",
       "Q 1578 4219 1281 4162 \n",
       "Q 984 4106 628 3988 \n",
       "L 628 4550 \n",
       "Q 988 4650 1302 4700 \n",
       "Q 1616 4750 1894 4750 \n",
       "Q 2613 4750 3031 4423 \n",
       "Q 3450 4097 3450 3541 \n",
       "Q 3450 3153 3228 2886 \n",
       "Q 3006 2619 2597 2516 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-Oblique-71\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-33\" transform=\"translate(63.476562 -16.40625) scale(0.7)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_5\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- 4 -->\n",
       "     <g transform=\"translate(69.244596 222.900922) scale(0.104 -0.104)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-34\" d=\"M 2419 4116 \n",
       "L 825 1625 \n",
       "L 2419 1625 \n",
       "L 2419 4116 \n",
       "z\n",
       "M 2253 4666 \n",
       "L 3047 4666 \n",
       "L 3047 1625 \n",
       "L 3713 1625 \n",
       "L 3713 1100 \n",
       "L 3047 1100 \n",
       "L 3047 0 \n",
       "L 2419 0 \n",
       "L 2419 1100 \n",
       "L 313 1100 \n",
       "L 313 1709 \n",
       "L 2253 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-34\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_6\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- c -->\n",
       "     <g transform=\"translate(46.403436 234.183181) scale(0.1625 -0.1625)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-63\" d=\"M 3122 3366 \n",
       "L 3122 2828 \n",
       "Q 2878 2963 2633 3030 \n",
       "Q 2388 3097 2138 3097 \n",
       "Q 1578 3097 1268 2742 \n",
       "Q 959 2388 959 1747 \n",
       "Q 959 1106 1268 751 \n",
       "Q 1578 397 2138 397 \n",
       "Q 2388 397 2633 464 \n",
       "Q 2878 531 3122 666 \n",
       "L 3122 134 \n",
       "Q 2881 22 2623 -34 \n",
       "Q 2366 -91 2075 -91 \n",
       "Q 1284 -91 818 406 \n",
       "Q 353 903 353 1747 \n",
       "Q 353 2603 823 3093 \n",
       "Q 1294 3584 2113 3584 \n",
       "Q 2378 3584 2631 3529 \n",
       "Q 2884 3475 3122 3366 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-63\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_7\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(84.752153 47.870387) scale(0.13 -0.13)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-48\" d=\"M 628 4666 \n",
       "L 1259 4666 \n",
       "L 1259 2753 \n",
       "L 3553 2753 \n",
       "L 3553 4666 \n",
       "L 4184 4666 \n",
       "L 4184 0 \n",
       "L 3553 0 \n",
       "L 3553 2222 \n",
       "L 1259 2222 \n",
       "L 1259 0 \n",
       "L 628 0 \n",
       "L 628 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_8\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(84.752153 94.224386) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_9\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(84.752153 140.578386) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_10\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(84.752153 186.932385) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_38\">\n",
       "    <path d=\"M 275.056354 21.1062 \n",
       "L 275.056354 67.460199 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke-dasharray: 3.7,1.6; stroke-dashoffset: 0; stroke: #000000\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_39\">\n",
       "    <path d=\"M 275.056354 67.460199 \n",
       "L 275.056354 113.814199 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke-dasharray: 3.7,1.6; stroke-dashoffset: 0; stroke: #000000\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_40\">\n",
       "    <path d=\"M 275.056354 113.814199 \n",
       "L 275.056354 160.168198 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke-dasharray: 3.7,1.6; stroke-dashoffset: 0; stroke: #000000\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_41\">\n",
       "    <path d=\"M 275.056354 160.168198 \n",
       "L 275.056354 206.522197 \n",
       "\" clip-path=\"url(#pa690307720)\" style=\"fill: none; stroke-dasharray: 3.7,1.6; stroke-dashoffset: 0; stroke: #000000\"/>\n",
       "   </g>\n",
       "   <g id=\"text_11\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- $-$1.57 -->\n",
       "     <g transform=\"translate(309.410353 55.529729) scale(0.08 -0.08)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-2212\" d=\"M 678 2272 \n",
       "L 4684 2272 \n",
       "L 4684 1741 \n",
       "L 678 1741 \n",
       "L 678 2272 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-2e\" d=\"M 684 794 \n",
       "L 1344 794 \n",
       "L 1344 0 \n",
       "L 684 0 \n",
       "L 684 794 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-35\" d=\"M 691 4666 \n",
       "L 3169 4666 \n",
       "L 3169 4134 \n",
       "L 1269 4134 \n",
       "L 1269 2991 \n",
       "Q 1406 3038 1543 3061 \n",
       "Q 1681 3084 1819 3084 \n",
       "Q 2600 3084 3056 2656 \n",
       "Q 3513 2228 3513 1497 \n",
       "Q 3513 744 3044 326 \n",
       "Q 2575 -91 1722 -91 \n",
       "Q 1428 -91 1123 -41 \n",
       "Q 819 9 494 109 \n",
       "L 494 744 \n",
       "Q 775 591 1075 516 \n",
       "Q 1375 441 1709 441 \n",
       "Q 2250 441 2565 725 \n",
       "Q 2881 1009 2881 1497 \n",
       "Q 2881 1984 2565 2268 \n",
       "Q 2250 2553 1709 2553 \n",
       "Q 1456 2553 1204 2497 \n",
       "Q 953 2441 691 2322 \n",
       "L 691 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-37\" d=\"M 525 4666 \n",
       "L 3525 4666 \n",
       "L 3525 4397 \n",
       "L 1831 0 \n",
       "L 1172 0 \n",
       "L 2766 4134 \n",
       "L 525 4134 \n",
       "L 525 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-2212\" transform=\"translate(0 0.09375)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(83.789062 0.09375)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(147.412109 0.09375)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(179.199219 0.09375)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-37\" transform=\"translate(235.572266 0.09375)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_12\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- P -->\n",
       "     <g transform=\"translate(317.491056 43.350872) scale(0.13 -0.13)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-50\" d=\"M 1259 4147 \n",
       "L 1259 2394 \n",
       "L 2053 2394 \n",
       "Q 2494 2394 2734 2622 \n",
       "Q 2975 2850 2975 3272 \n",
       "Q 2975 3691 2734 3919 \n",
       "Q 2494 4147 2053 4147 \n",
       "L 1259 4147 \n",
       "z\n",
       "M 628 4666 \n",
       "L 2053 4666 \n",
       "Q 2838 4666 3239 4311 \n",
       "Q 3641 3956 3641 3272 \n",
       "Q 3641 2581 3239 2228 \n",
       "Q 2838 1875 2053 1875 \n",
       "L 1259 1875 \n",
       "L 1259 0 \n",
       "L 628 0 \n",
       "L 628 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-50\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_13\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- $-$1.05 -->\n",
       "     <g transform=\"translate(309.130353 101.883729) scale(0.08 -0.08)\">\n",
       "      <use xlink:href=\"#DejaVuSans-2212\" transform=\"translate(0 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(83.789062 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(147.412109 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(179.199219 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(242.822266 0.78125)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_14\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- P -->\n",
       "     <g transform=\"translate(317.491056 89.704871) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-50\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_15\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- $-$0.785 -->\n",
       "     <g transform=\"translate(306.890353 148.237728) scale(0.08 -0.08)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-38\" d=\"M 2034 2216 \n",
       "Q 1584 2216 1326 1975 \n",
       "Q 1069 1734 1069 1313 \n",
       "Q 1069 891 1326 650 \n",
       "Q 1584 409 2034 409 \n",
       "Q 2484 409 2743 651 \n",
       "Q 3003 894 3003 1313 \n",
       "Q 3003 1734 2745 1975 \n",
       "Q 2488 2216 2034 2216 \n",
       "z\n",
       "M 1403 2484 \n",
       "Q 997 2584 770 2862 \n",
       "Q 544 3141 544 3541 \n",
       "Q 544 4100 942 4425 \n",
       "Q 1341 4750 2034 4750 \n",
       "Q 2731 4750 3128 4425 \n",
       "Q 3525 4100 3525 3541 \n",
       "Q 3525 3141 3298 2862 \n",
       "Q 3072 2584 2669 2484 \n",
       "Q 3125 2378 3379 2068 \n",
       "Q 3634 1759 3634 1313 \n",
       "Q 3634 634 3220 271 \n",
       "Q 2806 -91 2034 -91 \n",
       "Q 1263 -91 848 271 \n",
       "Q 434 634 434 1313 \n",
       "Q 434 1759 690 2068 \n",
       "Q 947 2378 1403 2484 \n",
       "z\n",
       "M 1172 3481 \n",
       "Q 1172 3119 1398 2916 \n",
       "Q 1625 2713 2034 2713 \n",
       "Q 2441 2713 2670 2916 \n",
       "Q 2900 3119 2900 3481 \n",
       "Q 2900 3844 2670 4047 \n",
       "Q 2441 4250 2034 4250 \n",
       "Q 1625 4250 1398 4047 \n",
       "Q 1172 3844 1172 3481 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-2212\" transform=\"translate(0 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(83.789062 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(147.412109 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-37\" transform=\"translate(171.449219 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-38\" transform=\"translate(235.072266 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(298.695312 0.78125)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_16\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- P -->\n",
       "     <g transform=\"translate(317.491056 136.058871) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-50\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_17\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(362.876149 47.870387) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_18\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(362.876149 94.224386) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_19\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(362.876149 140.578386) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_20\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- 2 -->\n",
       "     <g transform=\"translate(425.706852 222.900922) scale(0.104 -0.104)\">\n",
       "      <use xlink:href=\"#DejaVuSans-32\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_21\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- 0x1 -->\n",
       "     <g transform=\"translate(453.014851 244.816977) scale(0.08 -0.08)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-78\" d=\"M 3513 3500 \n",
       "L 2247 1797 \n",
       "L 3578 0 \n",
       "L 2900 0 \n",
       "L 1881 1375 \n",
       "L 863 0 \n",
       "L 184 0 \n",
       "L 1544 1831 \n",
       "L 300 3500 \n",
       "L 978 3500 \n",
       "L 1906 2253 \n",
       "L 2834 3500 \n",
       "L 3513 3500 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-78\" x=\"63.623047\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-31\" x=\"122.802734\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_22\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- X -->\n",
       "     <g transform=\"translate(456.019851 186.932385) scale(0.13 -0.13)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-58\" d=\"M 403 4666 \n",
       "L 1081 4666 \n",
       "L 2241 2931 \n",
       "L 3406 4666 \n",
       "L 4084 4666 \n",
       "L 2584 2425 \n",
       "L 4184 0 \n",
       "L 3506 0 \n",
       "L 2194 1984 \n",
       "L 872 0 \n",
       "L 191 0 \n",
       "L 1856 2491 \n",
       "L 403 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-58\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_23\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- 1 -->\n",
       "     <g transform=\"translate(518.41485 222.900922) scale(0.104 -0.104)\">\n",
       "      <use xlink:href=\"#DejaVuSans-31\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_24\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- 0x1 -->\n",
       "     <g transform=\"translate(545.72285 244.816977) scale(0.08 -0.08)\">\n",
       "      <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-78\" x=\"63.623047\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-31\" x=\"122.802734\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_25\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- Z -->\n",
       "     <g transform=\"translate(548.72785 186.932385) scale(0.13 -0.13)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-5a\" d=\"M 359 4666 \n",
       "L 4025 4666 \n",
       "L 4025 4184 \n",
       "L 1075 531 \n",
       "L 4097 531 \n",
       "L 4097 0 \n",
       "L 288 0 \n",
       "L 288 481 \n",
       "L 3238 4134 \n",
       "L 359 4134 \n",
       "L 359 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-5a\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_26\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- 0 -->\n",
       "     <g transform=\"translate(611.122849 222.900922) scale(0.104 -0.104)\">\n",
       "      <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_27\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- 0x1 -->\n",
       "     <g transform=\"translate(638.430849 244.816977) scale(0.08 -0.08)\">\n",
       "      <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-78\" x=\"63.623047\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-31\" x=\"122.802734\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_28\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- X -->\n",
       "     <g transform=\"translate(641.435849 186.932385) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-58\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_29\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- 0 -->\n",
       "     <g transform=\"translate(703.830848 222.900922) scale(0.104 -0.104)\">\n",
       "      <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_30\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- 1 -->\n",
       "     <g transform=\"translate(750.184847 222.900922) scale(0.104 -0.104)\">\n",
       "      <use xlink:href=\"#DejaVuSans-31\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_31\">\n",
       "    <g clip-path=\"url(#pa690307720)\">\n",
       "     <!-- 2 -->\n",
       "     <g transform=\"translate(796.538847 222.900922) scale(0.104 -0.104)\">\n",
       "      <use xlink:href=\"#DejaVuSans-32\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"pa690307720\">\n",
       "   <rect x=\"7.2\" y=\"7.2\" width=\"808.343986\" height=\"250.311597\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 1458.05x451.5 with 1 Axes>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alpha = np.pi / 2\n",
    "beta  = np.pi / 3\n",
    "gamma = np.pi / 4\n",
    "cir = dq.QubitCircuit(4)\n",
    "\n",
    "# prepare cluster state\n",
    "cir.hlayer()\n",
    "cir.cz(0, 1)\n",
    "cir.cz(1, 2)\n",
    "cir.cz(2, 3)\n",
    "cir.barrier()\n",
    "\n",
    "# measurement\n",
    "cir.p(0, -alpha)\n",
    "cir.h(0)\n",
    "cir.p(1, -beta)\n",
    "cir.h(1)\n",
    "cir.p(2, -gamma)\n",
    "cir.h(2)\n",
    "\n",
    "cir.x(3, controls=2, condition=True)\n",
    "cir.z(3, controls=1, condition=True)\n",
    "cir.x(3, controls=0, condition=True)\n",
    "cir()\n",
    "\n",
    "state, measure_rst, prob = cir.defer_measure(with_prob=True)\n",
    "print(state * np.exp(1j * (alpha + beta + gamma) / 2))\n",
    "print(cir.post_select(measure_rst) * np.exp(1j * (alpha + beta + gamma) / 2)) # choose measurement result\n",
    "\n",
    "cir.draw()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d4453c6b",
   "metadata": {},
   "source": [
    "Verify random single-qubit-rotation gate  in circuit based quantum computation(CBQC)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "0e57d3f4",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-29T09:42:14.735274Z",
     "start_time": "2023-08-29T09:42:14.659189Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([[0.3314+0.4619j],\n",
      "        [0.1913+0.8001j]])\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"302.631022pt\" height=\"79.295599pt\" viewBox=\"0 0 302.631022 79.295599\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2023-08-30T13:21:30.675950</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.7.2, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 79.295599 \n",
       "L 302.631022 79.295599 \n",
       "L 302.631022 0 \n",
       "L 0 0 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"line2d_1\">\n",
       "    <path d=\"M 54.390226 44.2832 \n",
       "L 290.795622 44.2832 \n",
       "\" clip-path=\"url(#p02046ad713)\" style=\"fill: none; stroke: #000000; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 64.356335 59.348249 \n",
       "L 94.486435 59.348249 \n",
       "L 94.486435 29.21815 \n",
       "L 64.356335 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#p02046ad713)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 110.710335 59.348249 \n",
       "L 140.840434 59.348249 \n",
       "L 140.840434 29.21815 \n",
       "L 110.710335 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#p02046ad713)\" style=\"fill: #bb8bff; stroke: #bb8bff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 157.064334 59.348249 \n",
       "L 187.194434 59.348249 \n",
       "L 187.194434 29.21815 \n",
       "L 157.064334 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#p02046ad713)\" style=\"fill: #bb8bff; stroke: #bb8bff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 202.546878 59.348249 \n",
       "L 234.419888 59.348249 \n",
       "L 234.419888 29.21815 \n",
       "L 202.546878 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#p02046ad713)\" style=\"fill: #bb8bff; stroke: #bb8bff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 249.772333 59.348249 \n",
       "L 279.902433 59.348249 \n",
       "L 279.902433 29.21815 \n",
       "L 249.772333 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#p02046ad713)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"text_1\">\n",
       "    <g clip-path=\"url(#p02046ad713)\">\n",
       "     <!-- ${q}$ -->\n",
       "     <g transform=\"translate(34.719426 48.734176) scale(0.1625 -0.1625)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-Oblique-71\" d=\"M 2669 525 \n",
       "Q 2438 222 2123 65 \n",
       "Q 1809 -91 1428 -91 \n",
       "Q 897 -91 595 267 \n",
       "Q 294 625 294 1253 \n",
       "Q 294 1759 480 2231 \n",
       "Q 666 2703 1013 3078 \n",
       "Q 1238 3322 1530 3453 \n",
       "Q 1822 3584 2144 3584 \n",
       "Q 2531 3584 2781 3431 \n",
       "Q 3031 3278 3144 2969 \n",
       "L 3244 3494 \n",
       "L 3822 3494 \n",
       "L 2888 -1319 \n",
       "L 2309 -1319 \n",
       "L 2669 525 \n",
       "z\n",
       "M 891 1338 \n",
       "Q 891 875 1084 633 \n",
       "Q 1278 391 1644 391 \n",
       "Q 2188 391 2572 911 \n",
       "Q 2956 1431 2956 2175 \n",
       "Q 2956 2625 2757 2864 \n",
       "Q 2559 3103 2188 3103 \n",
       "Q 1916 3103 1684 2976 \n",
       "Q 1453 2850 1281 2606 \n",
       "Q 1100 2350 995 2006 \n",
       "Q 891 1663 891 1338 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-Oblique-71\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_2\">\n",
       "    <g clip-path=\"url(#p02046ad713)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(74.533182 47.870387) scale(0.13 -0.13)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-48\" d=\"M 628 4666 \n",
       "L 1259 4666 \n",
       "L 1259 2753 \n",
       "L 3553 2753 \n",
       "L 3553 4666 \n",
       "L 4184 4666 \n",
       "L 4184 0 \n",
       "L 3553 0 \n",
       "L 3553 2222 \n",
       "L 1259 2222 \n",
       "L 1259 0 \n",
       "L 628 0 \n",
       "L 628 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_3\">\n",
       "    <g clip-path=\"url(#p02046ad713)\">\n",
       "     <!-- $-$1.57 -->\n",
       "     <g transform=\"translate(113.775385 55.529729) scale(0.08 -0.08)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-2212\" d=\"M 678 2272 \n",
       "L 4684 2272 \n",
       "L 4684 1741 \n",
       "L 678 1741 \n",
       "L 678 2272 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-31\" d=\"M 794 531 \n",
       "L 1825 531 \n",
       "L 1825 4091 \n",
       "L 703 3866 \n",
       "L 703 4441 \n",
       "L 1819 4666 \n",
       "L 2450 4666 \n",
       "L 2450 531 \n",
       "L 3481 531 \n",
       "L 3481 0 \n",
       "L 794 0 \n",
       "L 794 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-2e\" d=\"M 684 794 \n",
       "L 1344 794 \n",
       "L 1344 0 \n",
       "L 684 0 \n",
       "L 684 794 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-35\" d=\"M 691 4666 \n",
       "L 3169 4666 \n",
       "L 3169 4134 \n",
       "L 1269 4134 \n",
       "L 1269 2991 \n",
       "Q 1406 3038 1543 3061 \n",
       "Q 1681 3084 1819 3084 \n",
       "Q 2600 3084 3056 2656 \n",
       "Q 3513 2228 3513 1497 \n",
       "Q 3513 744 3044 326 \n",
       "Q 2575 -91 1722 -91 \n",
       "Q 1428 -91 1123 -41 \n",
       "Q 819 9 494 109 \n",
       "L 494 744 \n",
       "Q 775 591 1075 516 \n",
       "Q 1375 441 1709 441 \n",
       "Q 2250 441 2565 725 \n",
       "Q 2881 1009 2881 1497 \n",
       "Q 2881 1984 2565 2268 \n",
       "Q 2250 2553 1709 2553 \n",
       "Q 1456 2553 1204 2497 \n",
       "Q 953 2441 691 2322 \n",
       "L 691 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-37\" d=\"M 525 4666 \n",
       "L 3525 4666 \n",
       "L 3525 4397 \n",
       "L 1831 0 \n",
       "L 1172 0 \n",
       "L 2766 4134 \n",
       "L 525 4134 \n",
       "L 525 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-2212\" transform=\"translate(0 0.09375)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(83.789062 0.09375)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(147.412109 0.09375)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(179.199219 0.09375)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-37\" transform=\"translate(235.572266 0.09375)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_4\">\n",
       "    <g clip-path=\"url(#p02046ad713)\">\n",
       "     <!-- $\\mathrm{R_Z}$ -->\n",
       "     <g transform=\"translate(117.845385 43.350872) scale(0.13 -0.13)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-52\" d=\"M 2841 2188 \n",
       "Q 3044 2119 3236 1894 \n",
       "Q 3428 1669 3622 1275 \n",
       "L 4263 0 \n",
       "L 3584 0 \n",
       "L 2988 1197 \n",
       "Q 2756 1666 2539 1819 \n",
       "Q 2322 1972 1947 1972 \n",
       "L 1259 1972 \n",
       "L 1259 0 \n",
       "L 628 0 \n",
       "L 628 4666 \n",
       "L 2053 4666 \n",
       "Q 2853 4666 3247 4331 \n",
       "Q 3641 3997 3641 3322 \n",
       "Q 3641 2881 3436 2590 \n",
       "Q 3231 2300 2841 2188 \n",
       "z\n",
       "M 1259 4147 \n",
       "L 1259 2491 \n",
       "L 2053 2491 \n",
       "Q 2509 2491 2742 2702 \n",
       "Q 2975 2913 2975 3322 \n",
       "Q 2975 3731 2742 3939 \n",
       "Q 2509 4147 2053 4147 \n",
       "L 1259 4147 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-5a\" d=\"M 359 4666 \n",
       "L 4025 4666 \n",
       "L 4025 4184 \n",
       "L 1075 531 \n",
       "L 4097 531 \n",
       "L 4097 0 \n",
       "L 288 0 \n",
       "L 288 481 \n",
       "L 3238 4134 \n",
       "L 359 4134 \n",
       "L 359 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-52\" transform=\"translate(0 0.09375)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-5a\" transform=\"translate(70.439453 -16.3125) scale(0.7)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_5\">\n",
       "    <g clip-path=\"url(#p02046ad713)\">\n",
       "     <!-- $-$1.05 -->\n",
       "     <g transform=\"translate(159.849384 55.529729) scale(0.08 -0.08)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \n",
       "Q 1547 4250 1301 3770 \n",
       "Q 1056 3291 1056 2328 \n",
       "Q 1056 1369 1301 889 \n",
       "Q 1547 409 2034 409 \n",
       "Q 2525 409 2770 889 \n",
       "Q 3016 1369 3016 2328 \n",
       "Q 3016 3291 2770 3770 \n",
       "Q 2525 4250 2034 4250 \n",
       "z\n",
       "M 2034 4750 \n",
       "Q 2819 4750 3233 4129 \n",
       "Q 3647 3509 3647 2328 \n",
       "Q 3647 1150 3233 529 \n",
       "Q 2819 -91 2034 -91 \n",
       "Q 1250 -91 836 529 \n",
       "Q 422 1150 422 2328 \n",
       "Q 422 3509 836 4129 \n",
       "Q 1250 4750 2034 4750 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-2212\" transform=\"translate(0 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(83.789062 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(147.412109 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(179.199219 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(242.822266 0.78125)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_6\">\n",
       "    <g clip-path=\"url(#p02046ad713)\">\n",
       "     <!-- $\\mathrm{R_X}$ -->\n",
       "     <g transform=\"translate(164.199384 43.350872) scale(0.13 -0.13)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-58\" d=\"M 403 4666 \n",
       "L 1081 4666 \n",
       "L 2241 2931 \n",
       "L 3406 4666 \n",
       "L 4084 4666 \n",
       "L 2584 2425 \n",
       "L 4184 0 \n",
       "L 3506 0 \n",
       "L 2194 1984 \n",
       "L 872 0 \n",
       "L 191 0 \n",
       "L 1856 2491 \n",
       "L 403 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-52\" transform=\"translate(0 0.09375)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-58\" transform=\"translate(70.439453 -16.3125) scale(0.7)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_7\">\n",
       "    <g clip-path=\"url(#p02046ad713)\">\n",
       "     <!-- $-$0.785 -->\n",
       "     <g transform=\"translate(203.963383 55.529729) scale(0.08 -0.08)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-38\" d=\"M 2034 2216 \n",
       "Q 1584 2216 1326 1975 \n",
       "Q 1069 1734 1069 1313 \n",
       "Q 1069 891 1326 650 \n",
       "Q 1584 409 2034 409 \n",
       "Q 2484 409 2743 651 \n",
       "Q 3003 894 3003 1313 \n",
       "Q 3003 1734 2745 1975 \n",
       "Q 2488 2216 2034 2216 \n",
       "z\n",
       "M 1403 2484 \n",
       "Q 997 2584 770 2862 \n",
       "Q 544 3141 544 3541 \n",
       "Q 544 4100 942 4425 \n",
       "Q 1341 4750 2034 4750 \n",
       "Q 2731 4750 3128 4425 \n",
       "Q 3525 4100 3525 3541 \n",
       "Q 3525 3141 3298 2862 \n",
       "Q 3072 2584 2669 2484 \n",
       "Q 3125 2378 3379 2068 \n",
       "Q 3634 1759 3634 1313 \n",
       "Q 3634 634 3220 271 \n",
       "Q 2806 -91 2034 -91 \n",
       "Q 1263 -91 848 271 \n",
       "Q 434 634 434 1313 \n",
       "Q 434 1759 690 2068 \n",
       "Q 947 2378 1403 2484 \n",
       "z\n",
       "M 1172 3481 \n",
       "Q 1172 3119 1398 2916 \n",
       "Q 1625 2713 2034 2713 \n",
       "Q 2441 2713 2670 2916 \n",
       "Q 2900 3119 2900 3481 \n",
       "Q 2900 3844 2670 4047 \n",
       "Q 2441 4250 2034 4250 \n",
       "Q 1625 4250 1398 4047 \n",
       "Q 1172 3844 1172 3481 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-2212\" transform=\"translate(0 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(83.789062 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-2e\" transform=\"translate(147.412109 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-37\" transform=\"translate(171.449219 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-38\" transform=\"translate(235.072266 0.78125)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-35\" transform=\"translate(298.695312 0.78125)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_8\">\n",
       "    <g clip-path=\"url(#p02046ad713)\">\n",
       "     <!-- $\\mathrm{R_Z}$ -->\n",
       "     <g transform=\"translate(210.553383 43.350872) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-52\" transform=\"translate(0 0.09375)\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-5a\" transform=\"translate(70.439453 -16.3125) scale(0.7)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_9\">\n",
       "    <g clip-path=\"url(#p02046ad713)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(259.94918 47.870387) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"p02046ad713\">\n",
       "   <rect x=\"7.2\" y=\"7.2\" width=\"288.231022\" height=\"64.895599\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 519.897x117.056 with 1 Axes>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# verify\n",
    "cir = dq.QubitCircuit(1)\n",
    "cir.h(0)\n",
    "\n",
    "# alpha, beta, gamma系数的正负是根据测量结果决定的\n",
    "# q0的结果对应rx门的beta系数的正负\n",
    "# q1的结果对应第二个rz门的gamma系数的正负\n",
    "# alpha始终保持不变\n",
    "\n",
    "cir.rz(0, -alpha)\n",
    "cir.rx(0, beta * (-1) ** (int(measure_rst[0]) + 1))\n",
    "cir.rz(0, gamma * (-1) ** (int(measure_rst[1]) + 1))\n",
    "cir.h(0)\n",
    "\n",
    "print(cir())\n",
    "cir.draw()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "df98d542",
   "metadata": {},
   "source": [
    "## CNOT gate"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5e019b9a",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-29T02:54:10.751201Z",
     "start_time": "2023-08-29T02:54:10.730271Z"
    }
   },
   "source": [
    "Matrix representation for CNOT gate\n",
    "$$ CNOT=\n",
    "\\begin{pmatrix}\n",
    "1 & 0 & 0 & 0 \\\\\n",
    "0 & 1 & 0 & 0 \\\\\n",
    "0 & 0 & 0 & 1 \\\\\n",
    "0 & 0 & 1 & 0\n",
    "\\end{pmatrix}\n",
    "= |0><0| \\otimes I + |1><1| \\otimes X\n",
    "$$\n",
    "\n",
    "$$\n",
    "CNOT|++>=|++> \\\\\n",
    "CNOT|+->=|--> \\\\\n",
    "CNOT|-+>=|-+> \\\\\n",
    "CNOT|-->=|+->\n",
    "$$\n",
    "\n",
    "![MBQC example](./figure/basic_gate_MBQC/CNOT.jpg)\n",
    "<div style=\"text-align:center\">图 3: MBQC CNOT 的实现</div>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "35fe58c9",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-29T05:40:14.331395Z",
     "start_time": "2023-08-29T05:40:14.149008Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The probability of deferred measurement to get \"10\" is 0.24999994039535522.\n",
      "tensor([[0.5000+0.j, 0.5000+0.j, 0.5000+0.j, 0.5000+0.j]])\n",
      "tensor([[0.5000+0.j, 0.5000+0.j, 0.5000+0.j, 0.5000+0.j]])\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"822.743986pt\" height=\"264.711597pt\" viewBox=\"0 0 822.743986 264.711597\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2023-08-30T13:21:30.977711</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.7.2, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 264.711597 \n",
       "L 822.743986 264.711597 \n",
       "L 822.743986 0 \n",
       "L 0 0 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 454.446331 219.153662 \n",
       "L 466.498371 219.153662 \n",
       "L 460.472351 227.845037 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #778899\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 547.15433 219.153662 \n",
       "L 559.20637 219.153662 \n",
       "L 553.18035 227.845037 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #778899\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 639.862329 219.153662 \n",
       "L 651.914369 219.153662 \n",
       "L 645.888349 227.845037 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #778899\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 732.570328 219.153662 \n",
       "L 744.622367 219.153662 \n",
       "L 738.596348 227.845037 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #778899\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 778.924327 219.153662 \n",
       "L 790.976367 219.153662 \n",
       "L 784.950347 227.845037 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #778899\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_1\">\n",
       "    <path d=\"M 64.609196 44.2832 \n",
       "L 810.908587 44.2832 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #000000; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_2\">\n",
       "    <path d=\"M 64.609196 90.637199 \n",
       "L 810.908587 90.637199 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #000000; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_3\">\n",
       "    <path d=\"M 64.609196 136.991198 \n",
       "L 810.908587 136.991198 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #000000; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_4\">\n",
       "    <path d=\"M 64.609196 183.345198 \n",
       "L 810.908587 183.345198 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #000000; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_5\">\n",
       "    <path d=\"M 64.609196 228.192692 \n",
       "L 810.908587 228.192692 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_6\">\n",
       "    <path d=\"M 64.609196 231.205702 \n",
       "L 810.908587 231.205702 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_7\">\n",
       "    <path d=\"M 73.879996 234.334597 \n",
       "L 78.515396 225.063797 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #778899; stroke-width: 1.5; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_8\">\n",
       "    <path d=\"M 135.994356 90.637199 \n",
       "L 135.994356 136.991198 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_9\">\n",
       "    <path d=\"M 182.348355 90.637199 \n",
       "L 182.348355 44.2832 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_10\">\n",
       "    <path d=\"M 228.702354 136.991198 \n",
       "L 228.702354 44.2832 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_11\">\n",
       "    <path d=\"M 275.056354 183.345198 \n",
       "L 275.056354 44.2832 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_7\">\n",
       "    <path d=\"M 312.371323 67.460199 \n",
       "L 330.449383 67.460199 \n",
       "L 330.449383 21.1062 \n",
       "L 312.371323 21.1062 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #bdbdbd; opacity: 0.6\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_8\">\n",
       "    <path d=\"M 312.371323 113.814199 \n",
       "L 330.449383 113.814199 \n",
       "L 330.449383 67.460199 \n",
       "L 312.371323 67.460199 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #bdbdbd; opacity: 0.6\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_9\">\n",
       "    <path d=\"M 312.371323 160.168198 \n",
       "L 330.449383 160.168198 \n",
       "L 330.449383 113.814199 \n",
       "L 312.371323 113.814199 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #bdbdbd; opacity: 0.6\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_10\">\n",
       "    <path d=\"M 312.371323 206.522197 \n",
       "L 330.449383 206.522197 \n",
       "L 330.449383 160.168198 \n",
       "L 312.371323 160.168198 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #bdbdbd; opacity: 0.6\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_11\">\n",
       "    <path d=\"M 405.079322 67.460199 \n",
       "L 423.157382 67.460199 \n",
       "L 423.157382 21.1062 \n",
       "L 405.079322 21.1062 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #bdbdbd; opacity: 0.6\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_12\">\n",
       "    <path d=\"M 405.079322 113.814199 \n",
       "L 423.157382 113.814199 \n",
       "L 423.157382 67.460199 \n",
       "L 405.079322 67.460199 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #bdbdbd; opacity: 0.6\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_13\">\n",
       "    <path d=\"M 405.079322 160.168198 \n",
       "L 423.157382 160.168198 \n",
       "L 423.157382 113.814199 \n",
       "L 405.079322 113.814199 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #bdbdbd; opacity: 0.6\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_14\">\n",
       "    <path d=\"M 405.079322 206.522197 \n",
       "L 423.157382 206.522197 \n",
       "L 423.157382 160.168198 \n",
       "L 405.079322 160.168198 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #bdbdbd; opacity: 0.6\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_12\">\n",
       "    <path d=\"M 461.978856 44.2832 \n",
       "L 461.978856 219.153662 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_13\">\n",
       "    <path d=\"M 458.965846 44.2832 \n",
       "L 458.965846 219.153662 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_14\">\n",
       "    <path d=\"M 508.332856 183.345198 \n",
       "L 508.332856 229.699197 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_15\">\n",
       "    <path d=\"M 505.319846 183.345198 \n",
       "L 505.319846 229.699197 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_16\">\n",
       "    <path d=\"M 554.686855 90.637199 \n",
       "L 554.686855 219.153662 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_17\">\n",
       "    <path d=\"M 551.673845 90.637199 \n",
       "L 551.673845 219.153662 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_18\">\n",
       "    <path d=\"M 601.040854 136.991198 \n",
       "L 601.040854 229.699197 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_19\">\n",
       "    <path d=\"M 598.027844 136.991198 \n",
       "L 598.027844 229.699197 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_20\">\n",
       "    <path d=\"M 647.394854 90.637199 \n",
       "L 647.394854 219.153662 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_21\">\n",
       "    <path d=\"M 644.381844 90.637199 \n",
       "L 644.381844 219.153662 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_22\">\n",
       "    <path d=\"M 693.748853 183.345198 \n",
       "L 693.748853 229.699197 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_23\">\n",
       "    <path d=\"M 690.735843 183.345198 \n",
       "L 690.735843 229.699197 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_24\">\n",
       "    <path d=\"M 740.102852 44.2832 \n",
       "L 740.102852 219.153662 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_25\">\n",
       "    <path d=\"M 737.089843 44.2832 \n",
       "L 737.089843 219.153662 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_26\">\n",
       "    <path d=\"M 786.456852 90.637199 \n",
       "L 786.456852 219.153662 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_27\">\n",
       "    <path d=\"M 783.443842 90.637199 \n",
       "L 783.443842 219.153662 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #778899; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_28\">\n",
       "    <path d=\"M 129.968336 96.663219 \n",
       "L 142.020375 84.611179 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_29\">\n",
       "    <path d=\"M 129.968336 84.611179 \n",
       "L 142.020375 96.663219 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_30\">\n",
       "    <path d=\"M 129.968336 143.017218 \n",
       "L 142.020375 130.965178 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_31\">\n",
       "    <path d=\"M 129.968336 130.965178 \n",
       "L 142.020375 143.017218 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_32\">\n",
       "    <path d=\"M 182.348355 90.637199 \n",
       "L 182.348355 44.2832 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_33\">\n",
       "    <path d=\"M 228.702354 136.991198 \n",
       "L 228.702354 44.2832 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_34\">\n",
       "    <path d=\"M 275.056354 183.345198 \n",
       "L 275.056354 44.2832 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_15\">\n",
       "    <path d=\"M 74.575306 59.348249 \n",
       "L 104.705406 59.348249 \n",
       "L 104.705406 29.21815 \n",
       "L 74.575306 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_16\">\n",
       "    <path d=\"M 74.575306 105.702249 \n",
       "L 104.705406 105.702249 \n",
       "L 104.705406 75.572149 \n",
       "L 74.575306 75.572149 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_17\">\n",
       "    <path d=\"M 74.575306 152.056248 \n",
       "L 104.705406 152.056248 \n",
       "L 104.705406 121.926148 \n",
       "L 74.575306 121.926148 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_18\">\n",
       "    <path d=\"M 74.575306 198.410247 \n",
       "L 104.705406 198.410247 \n",
       "L 104.705406 168.280148 \n",
       "L 74.575306 168.280148 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_19\">\n",
       "    <path d=\"M 182.348355 48.802714 \n",
       "C 183.546944 48.802714 184.696604 48.32651 185.544135 47.478979 \n",
       "C 186.391665 46.631448 186.86787 45.481789 186.86787 44.2832 \n",
       "C 186.86787 43.08461 186.391665 41.934951 185.544135 41.08742 \n",
       "C 184.696604 40.239889 183.546944 39.763685 182.348355 39.763685 \n",
       "C 181.149766 39.763685 180.000106 40.239889 179.152575 41.08742 \n",
       "C 178.305045 41.934951 177.82884 43.08461 177.82884 44.2832 \n",
       "C 177.82884 45.481789 178.305045 46.631448 179.152575 47.478979 \n",
       "C 180.000106 48.32651 181.149766 48.802714 182.348355 48.802714 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_20\">\n",
       "    <path d=\"M 182.348355 95.156714 \n",
       "C 183.546944 95.156714 184.696604 94.680509 185.544135 93.832979 \n",
       "C 186.391665 92.985448 186.86787 91.835788 186.86787 90.637199 \n",
       "C 186.86787 89.43861 186.391665 88.28895 185.544135 87.441419 \n",
       "C 184.696604 86.593889 183.546944 86.117684 182.348355 86.117684 \n",
       "C 181.149766 86.117684 180.000106 86.593889 179.152575 87.441419 \n",
       "C 178.305045 88.28895 177.82884 89.43861 177.82884 90.637199 \n",
       "C 177.82884 91.835788 178.305045 92.985448 179.152575 93.832979 \n",
       "C 180.000106 94.680509 181.149766 95.156714 182.348355 95.156714 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_21\">\n",
       "    <path d=\"M 228.702354 48.802714 \n",
       "C 229.900944 48.802714 231.050603 48.32651 231.898134 47.478979 \n",
       "C 232.745665 46.631448 233.221869 45.481789 233.221869 44.2832 \n",
       "C 233.221869 43.08461 232.745665 41.934951 231.898134 41.08742 \n",
       "C 231.050603 40.239889 229.900944 39.763685 228.702354 39.763685 \n",
       "C 227.503765 39.763685 226.354105 40.239889 225.506575 41.08742 \n",
       "C 224.659044 41.934951 224.182839 43.08461 224.182839 44.2832 \n",
       "C 224.182839 45.481789 224.659044 46.631448 225.506575 47.478979 \n",
       "C 226.354105 48.32651 227.503765 48.802714 228.702354 48.802714 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_22\">\n",
       "    <path d=\"M 228.702354 141.510713 \n",
       "C 229.900944 141.510713 231.050603 141.034509 231.898134 140.186978 \n",
       "C 232.745665 139.339447 233.221869 138.189788 233.221869 136.991198 \n",
       "C 233.221869 135.792609 232.745665 134.642949 231.898134 133.795419 \n",
       "C 231.050603 132.947888 229.900944 132.471683 228.702354 132.471683 \n",
       "C 227.503765 132.471683 226.354105 132.947888 225.506575 133.795419 \n",
       "C 224.659044 134.642949 224.182839 135.792609 224.182839 136.991198 \n",
       "C 224.182839 138.189788 224.659044 139.339447 225.506575 140.186978 \n",
       "C 226.354105 141.034509 227.503765 141.510713 228.702354 141.510713 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_23\">\n",
       "    <path d=\"M 275.056354 48.802714 \n",
       "C 276.254943 48.802714 277.404603 48.32651 278.252133 47.478979 \n",
       "C 279.099664 46.631448 279.575869 45.481789 279.575869 44.2832 \n",
       "C 279.575869 43.08461 279.099664 41.934951 278.252133 41.08742 \n",
       "C 277.404603 40.239889 276.254943 39.763685 275.056354 39.763685 \n",
       "C 273.857764 39.763685 272.708105 40.239889 271.860574 41.08742 \n",
       "C 271.013043 41.934951 270.536839 43.08461 270.536839 44.2832 \n",
       "C 270.536839 45.481789 271.013043 46.631448 271.860574 47.478979 \n",
       "C 272.708105 48.32651 273.857764 48.802714 275.056354 48.802714 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_24\">\n",
       "    <path d=\"M 275.056354 187.864713 \n",
       "C 276.254943 187.864713 277.404603 187.388508 278.252133 186.540977 \n",
       "C 279.099664 185.693447 279.575869 184.543787 279.575869 183.345198 \n",
       "C 279.575869 182.146608 279.099664 180.996949 278.252133 180.149418 \n",
       "C 277.404603 179.301887 276.254943 178.825683 275.056354 178.825683 \n",
       "C 273.857764 178.825683 272.708105 179.301887 271.860574 180.149418 \n",
       "C 271.013043 180.996949 270.536839 182.146608 270.536839 183.345198 \n",
       "C 270.536839 184.543787 271.013043 185.693447 271.860574 186.540977 \n",
       "C 272.708105 187.388508 273.857764 187.864713 275.056354 187.864713 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_25\">\n",
       "    <path d=\"M 352.699303 59.348249 \n",
       "L 382.829402 59.348249 \n",
       "L 382.829402 29.21815 \n",
       "L 352.699303 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_26\">\n",
       "    <path d=\"M 352.699303 105.702249 \n",
       "L 382.829402 105.702249 \n",
       "L 382.829402 75.572149 \n",
       "L 352.699303 75.572149 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_27\">\n",
       "    <path d=\"M 445.407301 59.348249 \n",
       "L 475.537401 59.348249 \n",
       "L 475.537401 29.21815 \n",
       "L 445.407301 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_28\">\n",
       "    <path d=\"M 471.017886 48.802714 \n",
       "C 471.017886 46.006937 469.906083 43.322808 467.92917 41.345895 \n",
       "C 465.952257 39.368982 463.268128 38.25718 460.472351 38.25718 \n",
       "C 457.676574 38.25718 454.992445 39.368982 453.015532 41.345895 \n",
       "C 451.038619 43.322808 449.926816 46.006937 449.926816 48.802714 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_35\">\n",
       "    <path d=\"M 460.472351 48.802714 \n",
       "L 471.017886 38.25718 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_29\">\n",
       "    <path d=\"M 506.826351 234.218712 \n",
       "C 508.02494 234.218712 509.1746 233.742507 510.02213 232.894977 \n",
       "C 510.869661 232.047446 511.345866 230.897786 511.345866 229.699197 \n",
       "C 511.345866 228.500608 510.869661 227.350948 510.02213 226.503417 \n",
       "C 509.1746 225.655887 508.02494 225.179682 506.826351 225.179682 \n",
       "C 505.627761 225.179682 504.478102 225.655887 503.630571 226.503417 \n",
       "C 502.78304 227.350948 502.306836 228.500608 502.306836 229.699197 \n",
       "C 502.306836 230.897786 502.78304 232.047446 503.630571 232.894977 \n",
       "C 504.478102 233.742507 505.627761 234.218712 506.826351 234.218712 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_30\">\n",
       "    <path d=\"M 491.761301 198.410247 \n",
       "L 521.8914 198.410247 \n",
       "L 521.8914 168.280148 \n",
       "L 491.761301 168.280148 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #05bab6; stroke: #05bab6; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_31\">\n",
       "    <path d=\"M 538.1153 105.702249 \n",
       "L 568.2454 105.702249 \n",
       "L 568.2454 75.572149 \n",
       "L 538.1153 75.572149 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_32\">\n",
       "    <path d=\"M 563.725885 95.156714 \n",
       "C 563.725885 92.360937 562.614082 89.676808 560.637169 87.699895 \n",
       "C 558.660256 85.722982 555.976127 84.611179 553.18035 84.611179 \n",
       "C 550.384573 84.611179 547.700444 85.722982 545.723531 87.699895 \n",
       "C 543.746618 89.676808 542.634815 92.360937 542.634815 95.156714 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_36\">\n",
       "    <path d=\"M 553.18035 95.156714 \n",
       "L 563.725885 84.611179 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_33\">\n",
       "    <path d=\"M 599.534349 234.218712 \n",
       "C 600.732939 234.218712 601.882598 233.742507 602.730129 232.894977 \n",
       "C 603.57766 232.047446 604.053864 230.897786 604.053864 229.699197 \n",
       "C 604.053864 228.500608 603.57766 227.350948 602.730129 226.503417 \n",
       "C 601.882598 225.655887 600.732939 225.179682 599.534349 225.179682 \n",
       "C 598.33576 225.179682 597.1861 225.655887 596.33857 226.503417 \n",
       "C 595.491039 227.350948 595.014834 228.500608 595.014834 229.699197 \n",
       "C 595.014834 230.897786 595.491039 232.047446 596.33857 232.894977 \n",
       "C 597.1861 233.742507 598.33576 234.218712 599.534349 234.218712 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_34\">\n",
       "    <path d=\"M 584.4693 152.056248 \n",
       "L 614.599399 152.056248 \n",
       "L 614.599399 121.926148 \n",
       "L 584.4693 121.926148 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #05bab6; stroke: #05bab6; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_35\">\n",
       "    <path d=\"M 630.823299 105.702249 \n",
       "L 660.953399 105.702249 \n",
       "L 660.953399 75.572149 \n",
       "L 630.823299 75.572149 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_36\">\n",
       "    <path d=\"M 656.433884 95.156714 \n",
       "C 656.433884 92.360937 655.322081 89.676808 653.345168 87.699895 \n",
       "C 651.368255 85.722982 648.684126 84.611179 645.888349 84.611179 \n",
       "C 643.092572 84.611179 640.408442 85.722982 638.43153 87.699895 \n",
       "C 636.454617 89.676808 635.342814 92.360937 635.342814 95.156714 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_37\">\n",
       "    <path d=\"M 645.888349 95.156714 \n",
       "L 656.433884 84.611179 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_37\">\n",
       "    <path d=\"M 692.242348 234.218712 \n",
       "C 693.440937 234.218712 694.590597 233.742507 695.438128 232.894977 \n",
       "C 696.285658 232.047446 696.761863 230.897786 696.761863 229.699197 \n",
       "C 696.761863 228.500608 696.285658 227.350948 695.438128 226.503417 \n",
       "C 694.590597 225.655887 693.440937 225.179682 692.242348 225.179682 \n",
       "C 691.043759 225.179682 689.894099 225.655887 689.046568 226.503417 \n",
       "C 688.199038 227.350948 687.722833 228.500608 687.722833 229.699197 \n",
       "C 687.722833 230.897786 688.199038 232.047446 689.046568 232.894977 \n",
       "C 689.894099 233.742507 691.043759 234.218712 692.242348 234.218712 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_38\">\n",
       "    <path d=\"M 677.177298 198.410247 \n",
       "L 707.307398 198.410247 \n",
       "L 707.307398 168.280148 \n",
       "L 677.177298 168.280148 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: #05bab6; stroke: #05bab6; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_39\">\n",
       "    <path d=\"M 723.531298 59.348249 \n",
       "L 753.661397 59.348249 \n",
       "L 753.661397 29.21815 \n",
       "L 723.531298 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_40\">\n",
       "    <path d=\"M 749.141882 48.802714 \n",
       "C 749.141882 46.006937 748.03008 43.322808 746.053167 41.345895 \n",
       "C 744.076254 39.368982 741.392125 38.25718 738.596348 38.25718 \n",
       "C 735.80057 38.25718 733.116441 39.368982 731.139528 41.345895 \n",
       "C 729.162615 43.322808 728.050813 46.006937 728.050813 48.802714 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_38\">\n",
       "    <path d=\"M 738.596348 48.802714 \n",
       "L 749.141882 38.25718 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_41\">\n",
       "    <path d=\"M 769.885297 105.702249 \n",
       "L 800.015397 105.702249 \n",
       "L 800.015397 75.572149 \n",
       "L 769.885297 75.572149 \n",
       "z\n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"stroke: #000000; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_42\">\n",
       "    <path d=\"M 795.495882 95.156714 \n",
       "C 795.495882 92.360937 794.384079 89.676808 792.407166 87.699895 \n",
       "C 790.430253 85.722982 787.746124 84.611179 784.950347 84.611179 \n",
       "C 782.15457 84.611179 779.470441 85.722982 777.493528 87.699895 \n",
       "C 775.516615 89.676808 774.404812 92.360937 774.404812 95.156714 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_39\">\n",
       "    <path d=\"M 784.950347 95.156714 \n",
       "L 795.495882 84.611179 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"text_1\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- ${q}_{0}$ -->\n",
       "     <g transform=\"translate(37.300897 48.734176) scale(0.1625 -0.1625)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-Oblique-71\" d=\"M 2669 525 \n",
       "Q 2438 222 2123 65 \n",
       "Q 1809 -91 1428 -91 \n",
       "Q 897 -91 595 267 \n",
       "Q 294 625 294 1253 \n",
       "Q 294 1759 480 2231 \n",
       "Q 666 2703 1013 3078 \n",
       "Q 1238 3322 1530 3453 \n",
       "Q 1822 3584 2144 3584 \n",
       "Q 2531 3584 2781 3431 \n",
       "Q 3031 3278 3144 2969 \n",
       "L 3244 3494 \n",
       "L 3822 3494 \n",
       "L 2888 -1319 \n",
       "L 2309 -1319 \n",
       "L 2669 525 \n",
       "z\n",
       "M 891 1338 \n",
       "Q 891 875 1084 633 \n",
       "Q 1278 391 1644 391 \n",
       "Q 2188 391 2572 911 \n",
       "Q 2956 1431 2956 2175 \n",
       "Q 2956 2625 2757 2864 \n",
       "Q 2559 3103 2188 3103 \n",
       "Q 1916 3103 1684 2976 \n",
       "Q 1453 2850 1281 2606 \n",
       "Q 1100 2350 995 2006 \n",
       "Q 891 1663 891 1338 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \n",
       "Q 1547 4250 1301 3770 \n",
       "Q 1056 3291 1056 2328 \n",
       "Q 1056 1369 1301 889 \n",
       "Q 1547 409 2034 409 \n",
       "Q 2525 409 2770 889 \n",
       "Q 3016 1369 3016 2328 \n",
       "Q 3016 3291 2770 3770 \n",
       "Q 2525 4250 2034 4250 \n",
       "z\n",
       "M 2034 4750 \n",
       "Q 2819 4750 3233 4129 \n",
       "Q 3647 3509 3647 2328 \n",
       "Q 3647 1150 3233 529 \n",
       "Q 2819 -91 2034 -91 \n",
       "Q 1250 -91 836 529 \n",
       "Q 422 1150 422 2328 \n",
       "Q 422 3509 836 4129 \n",
       "Q 1250 4750 2034 4750 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-Oblique-71\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(63.476562 -16.40625) scale(0.7)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_2\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- ${q}_{1}$ -->\n",
       "     <g transform=\"translate(37.300897 95.088175) scale(0.1625 -0.1625)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-31\" d=\"M 794 531 \n",
       "L 1825 531 \n",
       "L 1825 4091 \n",
       "L 703 3866 \n",
       "L 703 4441 \n",
       "L 1819 4666 \n",
       "L 2450 4666 \n",
       "L 2450 531 \n",
       "L 3481 531 \n",
       "L 3481 0 \n",
       "L 794 0 \n",
       "L 794 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-Oblique-71\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(63.476562 -16.40625) scale(0.7)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_3\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- ${q}_{2}$ -->\n",
       "     <g transform=\"translate(37.300897 141.442175) scale(0.1625 -0.1625)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-32\" d=\"M 1228 531 \n",
       "L 3431 531 \n",
       "L 3431 0 \n",
       "L 469 0 \n",
       "L 469 531 \n",
       "Q 828 903 1448 1529 \n",
       "Q 2069 2156 2228 2338 \n",
       "Q 2531 2678 2651 2914 \n",
       "Q 2772 3150 2772 3378 \n",
       "Q 2772 3750 2511 3984 \n",
       "Q 2250 4219 1831 4219 \n",
       "Q 1534 4219 1204 4116 \n",
       "Q 875 4013 500 3803 \n",
       "L 500 4441 \n",
       "Q 881 4594 1212 4672 \n",
       "Q 1544 4750 1819 4750 \n",
       "Q 2544 4750 2975 4387 \n",
       "Q 3406 4025 3406 3419 \n",
       "Q 3406 3131 3298 2873 \n",
       "Q 3191 2616 2906 2266 \n",
       "Q 2828 2175 2409 1742 \n",
       "Q 1991 1309 1228 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-Oblique-71\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-32\" transform=\"translate(63.476562 -16.40625) scale(0.7)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_4\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- ${q}_{3}$ -->\n",
       "     <g transform=\"translate(37.300897 187.796174) scale(0.1625 -0.1625)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-33\" d=\"M 2597 2516 \n",
       "Q 3050 2419 3304 2112 \n",
       "Q 3559 1806 3559 1356 \n",
       "Q 3559 666 3084 287 \n",
       "Q 2609 -91 1734 -91 \n",
       "Q 1441 -91 1130 -33 \n",
       "Q 819 25 488 141 \n",
       "L 488 750 \n",
       "Q 750 597 1062 519 \n",
       "Q 1375 441 1716 441 \n",
       "Q 2309 441 2620 675 \n",
       "Q 2931 909 2931 1356 \n",
       "Q 2931 1769 2642 2001 \n",
       "Q 2353 2234 1838 2234 \n",
       "L 1294 2234 \n",
       "L 1294 2753 \n",
       "L 1863 2753 \n",
       "Q 2328 2753 2575 2939 \n",
       "Q 2822 3125 2822 3475 \n",
       "Q 2822 3834 2567 4026 \n",
       "Q 2313 4219 1838 4219 \n",
       "Q 1578 4219 1281 4162 \n",
       "Q 984 4106 628 3988 \n",
       "L 628 4550 \n",
       "Q 988 4650 1302 4700 \n",
       "Q 1616 4750 1894 4750 \n",
       "Q 2613 4750 3031 4423 \n",
       "Q 3450 4097 3450 3541 \n",
       "Q 3450 3153 3228 2886 \n",
       "Q 3006 2619 2597 2516 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-Oblique-71\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-33\" transform=\"translate(63.476562 -16.40625) scale(0.7)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_5\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- 4 -->\n",
       "     <g transform=\"translate(69.244596 222.900922) scale(0.104 -0.104)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-34\" d=\"M 2419 4116 \n",
       "L 825 1625 \n",
       "L 2419 1625 \n",
       "L 2419 4116 \n",
       "z\n",
       "M 2253 4666 \n",
       "L 3047 4666 \n",
       "L 3047 1625 \n",
       "L 3713 1625 \n",
       "L 3713 1100 \n",
       "L 3047 1100 \n",
       "L 3047 0 \n",
       "L 2419 0 \n",
       "L 2419 1100 \n",
       "L 313 1100 \n",
       "L 313 1709 \n",
       "L 2253 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-34\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_6\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- c -->\n",
       "     <g transform=\"translate(46.403436 234.183181) scale(0.1625 -0.1625)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-63\" d=\"M 3122 3366 \n",
       "L 3122 2828 \n",
       "Q 2878 2963 2633 3030 \n",
       "Q 2388 3097 2138 3097 \n",
       "Q 1578 3097 1268 2742 \n",
       "Q 959 2388 959 1747 \n",
       "Q 959 1106 1268 751 \n",
       "Q 1578 397 2138 397 \n",
       "Q 2388 397 2633 464 \n",
       "Q 2878 531 3122 666 \n",
       "L 3122 134 \n",
       "Q 2881 22 2623 -34 \n",
       "Q 2366 -91 2075 -91 \n",
       "Q 1284 -91 818 406 \n",
       "Q 353 903 353 1747 \n",
       "Q 353 2603 823 3093 \n",
       "Q 1294 3584 2113 3584 \n",
       "Q 2378 3584 2631 3529 \n",
       "Q 2884 3475 3122 3366 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-63\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_7\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(84.752153 47.870387) scale(0.13 -0.13)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-48\" d=\"M 628 4666 \n",
       "L 1259 4666 \n",
       "L 1259 2753 \n",
       "L 3553 2753 \n",
       "L 3553 4666 \n",
       "L 4184 4666 \n",
       "L 4184 0 \n",
       "L 3553 0 \n",
       "L 3553 2222 \n",
       "L 1259 2222 \n",
       "L 1259 0 \n",
       "L 628 0 \n",
       "L 628 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_8\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(84.752153 94.224386) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_9\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(84.752153 140.578386) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_10\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(84.752153 186.932385) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_40\">\n",
       "    <path d=\"M 321.410353 21.1062 \n",
       "L 321.410353 67.460199 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke-dasharray: 3.7,1.6; stroke-dashoffset: 0; stroke: #000000\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_41\">\n",
       "    <path d=\"M 321.410353 67.460199 \n",
       "L 321.410353 113.814199 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke-dasharray: 3.7,1.6; stroke-dashoffset: 0; stroke: #000000\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_42\">\n",
       "    <path d=\"M 321.410353 113.814199 \n",
       "L 321.410353 160.168198 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke-dasharray: 3.7,1.6; stroke-dashoffset: 0; stroke: #000000\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_43\">\n",
       "    <path d=\"M 321.410353 160.168198 \n",
       "L 321.410353 206.522197 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke-dasharray: 3.7,1.6; stroke-dashoffset: 0; stroke: #000000\"/>\n",
       "   </g>\n",
       "   <g id=\"text_11\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(362.876149 47.870387) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_12\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(362.876149 94.224386) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_44\">\n",
       "    <path d=\"M 414.118352 21.1062 \n",
       "L 414.118352 67.460199 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke-dasharray: 3.7,1.6; stroke-dashoffset: 0; stroke: #000000\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_45\">\n",
       "    <path d=\"M 414.118352 67.460199 \n",
       "L 414.118352 113.814199 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke-dasharray: 3.7,1.6; stroke-dashoffset: 0; stroke: #000000\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_46\">\n",
       "    <path d=\"M 414.118352 113.814199 \n",
       "L 414.118352 160.168198 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke-dasharray: 3.7,1.6; stroke-dashoffset: 0; stroke: #000000\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_47\">\n",
       "    <path d=\"M 414.118352 160.168198 \n",
       "L 414.118352 206.522197 \n",
       "\" clip-path=\"url(#p50127c174d)\" style=\"fill: none; stroke-dasharray: 3.7,1.6; stroke-dashoffset: 0; stroke: #000000\"/>\n",
       "   </g>\n",
       "   <g id=\"text_13\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- 0 -->\n",
       "     <g transform=\"translate(472.060851 222.900922) scale(0.104 -0.104)\">\n",
       "      <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_14\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- 0x1 -->\n",
       "     <g transform=\"translate(499.368851 244.816977) scale(0.08 -0.08)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-78\" d=\"M 3513 3500 \n",
       "L 2247 1797 \n",
       "L 3578 0 \n",
       "L 2900 0 \n",
       "L 1881 1375 \n",
       "L 863 0 \n",
       "L 184 0 \n",
       "L 1544 1831 \n",
       "L 300 3500 \n",
       "L 978 3500 \n",
       "L 1906 2253 \n",
       "L 2834 3500 \n",
       "L 3513 3500 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-78\" x=\"63.623047\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-31\" x=\"122.802734\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_15\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- X -->\n",
       "     <g transform=\"translate(502.373851 186.932385) scale(0.13 -0.13)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-58\" d=\"M 403 4666 \n",
       "L 1081 4666 \n",
       "L 2241 2931 \n",
       "L 3406 4666 \n",
       "L 4084 4666 \n",
       "L 2584 2425 \n",
       "L 4184 0 \n",
       "L 3506 0 \n",
       "L 2194 1984 \n",
       "L 872 0 \n",
       "L 191 0 \n",
       "L 1856 2491 \n",
       "L 403 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-58\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_16\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- 1 -->\n",
       "     <g transform=\"translate(564.76885 222.900922) scale(0.104 -0.104)\">\n",
       "      <use xlink:href=\"#DejaVuSans-31\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_17\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- 0x1 -->\n",
       "     <g transform=\"translate(592.076849 244.816977) scale(0.08 -0.08)\">\n",
       "      <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-78\" x=\"63.623047\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-31\" x=\"122.802734\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_18\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- Z -->\n",
       "     <g transform=\"translate(595.081849 140.578386) scale(0.13 -0.13)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-5a\" d=\"M 359 4666 \n",
       "L 4025 4666 \n",
       "L 4025 4184 \n",
       "L 1075 531 \n",
       "L 4097 531 \n",
       "L 4097 0 \n",
       "L 288 0 \n",
       "L 288 481 \n",
       "L 3238 4134 \n",
       "L 359 4134 \n",
       "L 359 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-5a\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_19\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- 1 -->\n",
       "     <g transform=\"translate(657.476849 222.900922) scale(0.104 -0.104)\">\n",
       "      <use xlink:href=\"#DejaVuSans-31\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_20\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- 0x1 -->\n",
       "     <g transform=\"translate(684.784848 244.816977) scale(0.08 -0.08)\">\n",
       "      <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-78\" x=\"63.623047\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-31\" x=\"122.802734\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_21\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- Z -->\n",
       "     <g transform=\"translate(687.789848 186.932385) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-5a\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_22\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- 0 -->\n",
       "     <g transform=\"translate(750.184847 222.900922) scale(0.104 -0.104)\">\n",
       "      <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_23\">\n",
       "    <g clip-path=\"url(#p50127c174d)\">\n",
       "     <!-- 1 -->\n",
       "     <g transform=\"translate(796.538847 222.900922) scale(0.104 -0.104)\">\n",
       "      <use xlink:href=\"#DejaVuSans-31\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"p50127c174d\">\n",
       "   <rect x=\"7.2\" y=\"7.2\" width=\"808.343986\" height=\"250.311597\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 1458.05x451.5 with 1 Axes>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cir = dq.QubitCircuit(4)\n",
    "\n",
    "# construct cluster state\n",
    "# cir.x(1)  # input |->|+> state\n",
    "# cir.x(2)  # input |+>|-> state\n",
    "\n",
    "cir.hlayer()\n",
    "cir.swap([1,2])\n",
    "cir.cz(0, 1)\n",
    "cir.cz(0, 2)\n",
    "cir.cz(0, 3)\n",
    "cir.barrier()\n",
    "\n",
    "# measurement\n",
    "cir.h(0)\n",
    "cir.h(1)\n",
    "cir.barrier()\n",
    "\n",
    "cir.x(3, controls=0, condition=True)\n",
    "cir.z(2, controls=1, condition=True)\n",
    "cir.z(3, controls=1, condition=True)\n",
    "\n",
    "cir()\n",
    "\n",
    "state, measure_rst, prob = cir.defer_measure(with_prob=True)\n",
    "print(state)\n",
    "print(cir.post_select(measure_rst)) # choose measurement result\n",
    "\n",
    "cir.draw()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b3b25519",
   "metadata": {},
   "source": [
    "Verify CNOT gate in circuit-based quantum computation (CBQC)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "4d585073",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-29T09:45:37.274839Z",
     "start_time": "2023-08-29T09:45:37.201083Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([[0.5000+0.j],\n",
      "        [0.5000+0.j],\n",
      "        [0.5000+0.j],\n",
      "        [0.5000+0.j]])\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"173.67605pt\" height=\"125.649599pt\" viewBox=\"0 0 173.67605 125.649599\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2023-08-30T13:21:31.256196</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.7.2, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M -0 125.649599 \n",
       "L 173.67605 125.649599 \n",
       "L 173.67605 0 \n",
       "L -0 0 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"line2d_1\">\n",
       "    <path d=\"M 64.497252 44.2832 \n",
       "L 161.84065 44.2832 \n",
       "\" clip-path=\"url(#p2a5e2056bc)\" style=\"fill: none; stroke: #000000; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_2\">\n",
       "    <path d=\"M 64.497252 90.637199 \n",
       "L 161.84065 90.637199 \n",
       "\" clip-path=\"url(#p2a5e2056bc)\" style=\"fill: none; stroke: #000000; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_3\">\n",
       "    <path d=\"M 135.882411 90.637199 \n",
       "L 135.882411 44.2832 \n",
       "\" clip-path=\"url(#p2a5e2056bc)\" style=\"fill: none; stroke: #6fa4ff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 74.463361 59.348249 \n",
       "L 104.593461 59.348249 \n",
       "L 104.593461 29.21815 \n",
       "L 74.463361 29.21815 \n",
       "z\n",
       "\" clip-path=\"url(#p2a5e2056bc)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 74.463361 105.702249 \n",
       "L 104.593461 105.702249 \n",
       "L 104.593461 75.572149 \n",
       "L 74.463361 75.572149 \n",
       "z\n",
       "\" clip-path=\"url(#p2a5e2056bc)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 135.882411 48.802714 \n",
       "C 137.081 48.802714 138.23066 48.32651 139.07819 47.478979 \n",
       "C 139.925721 46.631448 140.401926 45.481789 140.401926 44.2832 \n",
       "C 140.401926 43.08461 139.925721 41.934951 139.07819 41.08742 \n",
       "C 138.23066 40.239889 137.081 39.763685 135.882411 39.763685 \n",
       "C 134.683821 39.763685 133.534162 40.239889 132.686631 41.08742 \n",
       "C 131.8391 41.934951 131.362896 43.08461 131.362896 44.2832 \n",
       "C 131.362896 45.481789 131.8391 46.631448 132.686631 47.478979 \n",
       "C 133.534162 48.32651 134.683821 48.802714 135.882411 48.802714 \n",
       "z\n",
       "\" clip-path=\"url(#p2a5e2056bc)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 1.5; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 135.882411 101.182734 \n",
       "C 138.679119 101.182734 141.361658 100.07159 143.33923 98.094018 \n",
       "C 145.316801 96.116447 146.427945 93.433907 146.427945 90.637199 \n",
       "C 146.427945 87.84049 145.316801 85.157951 143.33923 83.18038 \n",
       "C 141.361658 81.202808 138.679119 80.091664 135.882411 80.091664 \n",
       "C 133.085702 80.091664 130.403163 81.202808 128.425591 83.18038 \n",
       "C 126.44802 85.157951 125.336876 87.84049 125.336876 90.637199 \n",
       "C 125.336876 93.433907 126.44802 96.116447 128.425591 98.094018 \n",
       "C 130.403163 100.07159 133.085702 101.182734 135.882411 101.182734 \n",
       "z\n",
       "\" clip-path=\"url(#p2a5e2056bc)\" style=\"fill: #6fa4ff; stroke: #6fa4ff; stroke-width: 2; stroke-linejoin: miter\"/>\n",
       "   </g>\n",
       "   <g id=\"text_1\">\n",
       "    <g clip-path=\"url(#p2a5e2056bc)\">\n",
       "     <!-- ${q}_{0}$ -->\n",
       "     <g transform=\"translate(37.188952 48.734176) scale(0.1625 -0.1625)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-Oblique-71\" d=\"M 2669 525 \n",
       "Q 2438 222 2123 65 \n",
       "Q 1809 -91 1428 -91 \n",
       "Q 897 -91 595 267 \n",
       "Q 294 625 294 1253 \n",
       "Q 294 1759 480 2231 \n",
       "Q 666 2703 1013 3078 \n",
       "Q 1238 3322 1530 3453 \n",
       "Q 1822 3584 2144 3584 \n",
       "Q 2531 3584 2781 3431 \n",
       "Q 3031 3278 3144 2969 \n",
       "L 3244 3494 \n",
       "L 3822 3494 \n",
       "L 2888 -1319 \n",
       "L 2309 -1319 \n",
       "L 2669 525 \n",
       "z\n",
       "M 891 1338 \n",
       "Q 891 875 1084 633 \n",
       "Q 1278 391 1644 391 \n",
       "Q 2188 391 2572 911 \n",
       "Q 2956 1431 2956 2175 \n",
       "Q 2956 2625 2757 2864 \n",
       "Q 2559 3103 2188 3103 \n",
       "Q 1916 3103 1684 2976 \n",
       "Q 1453 2850 1281 2606 \n",
       "Q 1100 2350 995 2006 \n",
       "Q 891 1663 891 1338 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \n",
       "Q 1547 4250 1301 3770 \n",
       "Q 1056 3291 1056 2328 \n",
       "Q 1056 1369 1301 889 \n",
       "Q 1547 409 2034 409 \n",
       "Q 2525 409 2770 889 \n",
       "Q 3016 1369 3016 2328 \n",
       "Q 3016 3291 2770 3770 \n",
       "Q 2525 4250 2034 4250 \n",
       "z\n",
       "M 2034 4750 \n",
       "Q 2819 4750 3233 4129 \n",
       "Q 3647 3509 3647 2328 \n",
       "Q 3647 1150 3233 529 \n",
       "Q 2819 -91 2034 -91 \n",
       "Q 1250 -91 836 529 \n",
       "Q 422 1150 422 2328 \n",
       "Q 422 3509 836 4129 \n",
       "Q 1250 4750 2034 4750 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-Oblique-71\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-30\" transform=\"translate(63.476562 -16.40625) scale(0.7)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_2\">\n",
       "    <g clip-path=\"url(#p2a5e2056bc)\">\n",
       "     <!-- ${q}_{1}$ -->\n",
       "     <g transform=\"translate(37.188952 95.088175) scale(0.1625 -0.1625)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-31\" d=\"M 794 531 \n",
       "L 1825 531 \n",
       "L 1825 4091 \n",
       "L 703 3866 \n",
       "L 703 4441 \n",
       "L 1819 4666 \n",
       "L 2450 4666 \n",
       "L 2450 531 \n",
       "L 3481 531 \n",
       "L 3481 0 \n",
       "L 794 0 \n",
       "L 794 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-Oblique-71\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-31\" transform=\"translate(63.476562 -16.40625) scale(0.7)\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_3\">\n",
       "    <g clip-path=\"url(#p2a5e2056bc)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(84.640208 47.870387) scale(0.13 -0.13)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-48\" d=\"M 628 4666 \n",
       "L 1259 4666 \n",
       "L 1259 2753 \n",
       "L 3553 2753 \n",
       "L 3553 4666 \n",
       "L 4184 4666 \n",
       "L 4184 0 \n",
       "L 3553 0 \n",
       "L 3553 2222 \n",
       "L 1259 2222 \n",
       "L 1259 0 \n",
       "L 628 0 \n",
       "L 628 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"text_4\">\n",
       "    <g clip-path=\"url(#p2a5e2056bc)\">\n",
       "     <!-- H -->\n",
       "     <g transform=\"translate(84.640208 94.224386) scale(0.13 -0.13)\">\n",
       "      <use xlink:href=\"#DejaVuSans-48\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_4\">\n",
       "    <path d=\"M 135.882411 96.663219 \n",
       "L 135.882411 84.611179 \n",
       "\" clip-path=\"url(#p2a5e2056bc)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"line2d_5\">\n",
       "    <path d=\"M 129.856391 90.637199 \n",
       "L 141.908431 90.637199 \n",
       "\" clip-path=\"url(#p2a5e2056bc)\" style=\"fill: none; stroke: #ffffff; stroke-width: 2; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"p2a5e2056bc\">\n",
       "   <rect x=\"7.2\" y=\"7.2\" width=\"159.27605\" height=\"111.249599\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 287.294x200.667 with 1 Axes>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cir = dq.QubitCircuit(2)\n",
    "# cir.x(0)\n",
    "# cir.x(1)\n",
    "\n",
    "cir.hlayer()\n",
    "cir.cx(0, 1)\n",
    "print(cir())\n",
    "cir.draw()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "qdl",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.17"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
